Skip to content

feat nuevoanimal #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions .github/workflows/docker.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/test.yml

This file was deleted.

39 changes: 1 addition & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1 @@
# Animal Farm

A sample Express application written in Node.js for a Github README post.

## Prerequisites

* Node.js
* yarn

### Install modules

Run `yarn` to install the required node modules.

```shell
yarn install
```

## Running

You can run the sample app in a couple of different ways. The first is to launch the application via `yarn`:

```shell
yarn start
```

Or you can directly run it via `node`:

```shell
node app.js
```

## Tests

You can also run the tests via `yarn`:

```shell
yarn test
```
# Fork para la práctica 7.1 de Despliegue de aplicaciones web de 2º de DAW en el IES Severo Ochoa de Elche.
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ var animals = {
"eel": "hiss",
"bear": "growl",
"frog": "croak",
"lion": "roar"
"lion": "roar",
"bird": "tweet"
}

function getAnimal() {
Expand Down
52 changes: 26 additions & 26 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@ const app = require('../app.js');
const request = require('supertest')(app);

describe('GET', function(){
it('respond with text/html', function(done){
request
.get('/')
.set('Accept', 'text/html')
.expect('Content-Type', /html/)
.expect(200, done);
})
it('respuesta contiene text/html', function(done){
request
.get('/')
.set('Accept', 'text/html')
.expect('Content-Type', /html/)
.expect(200, done);
})

it('respond with George Orwell', function(done){
request
.get('/')
.set('Accept', 'text/html')
.expect(200, /George Orwell had a farm/ig, done);
})
it('respuesta contiene George Orwell', function(done){
request
.get('/')
.set('Accept', 'text/html')
.expect(200, /George Orwell had a farm/ig, done);
})

it('/api responds with json', function(done){
request
.get('/api')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200, done);
})
it('/api respuesta contiene json', function(done){
request
.get('/api')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200, done);
})

it('/api responds with animals object', function(done){
request
.get('/api')
.set('Accept', 'application/json')
.expect(200, {"cat":"meow","dog":"bark","eel":"hiss","bear":"growl","frog":"croak","lion":"roar"}, done);
})
it('/api respuesta contiene objeto animales', function(done){
request
.get('/api')
.set('Accept', 'application/json')
.expect(200, {"cat":"meow","dog":"bark","eel":"hiss","bear":"growl","frog":"croak","lion":"roar","bird":"tweet"}, done);
})
})