Skip to content

Commit

Permalink
testeo las funciones para #38 #27
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelfdez99 committed Jan 15, 2021
1 parent 1e8725b commit 385dfcf
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions tests/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('GET /status', () => {
})
})

//HU:01 ---> Mostrar información de una prenda
//HU01 ---> Mostrar información de una prenda
describe('GET /item', () => {
it('should get every item', (done) => {
request(app)
Expand All @@ -21,18 +21,20 @@ describe('GET /item', () => {
})


//HU:02 ---> Añadir una prenda nueva
//HU02 ---> Añadir una prenda nueva
describe('PUT /item', () => {
it('should add a new item', (done) => {
request(app)
.put('/item')
.send(item)
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(201,done());
})
})


//HU:04 ---> Modificar una prenda
//HU04 ---> Modificar una prenda
describe('PUT /item/:type', () => {
it('should update an item', (done) => {
request(app)
Expand All @@ -43,17 +45,36 @@ describe('PUT /item/:type', () => {
})
})

//HU:07 ---> Como usuario quiero consultar el tipo de prenda que hay de una determinada marca
//HU07 ---> Como usuario quiero consultar el tipo de prenda que hay de una determinada marca
describe('GET /item/:brand', () => {
it('should get all the information about items of certain brand', (done) => {
it('should get all the information about certain brand', (done) => {
request(app)
.get('/item/NIKE')
.expect('Content-Type', /json/)
.expect('Content-Type', 'application/json')
.expect(200, done());
})
})

//HU06 --> Como usuario quiero consultar el tipo de prenda disponible de una temporada en concreto
describe('GET /item/season/:season', () => {
it('should get all the information about certain season', (done) => {
request(app)
.get('/item/season/SPRING_SUMMER')
.expect('Content-Type', 'application/json')
.expect(200, done());
})
})

describe('GET /item/color/:color', () => {
it('should get all the information about certain color', (done) => {
request(app)
.get('/item/color/RED')
.expect('Content-Type', 'application/json')
.expect(200, done());
})
})

//HU:03 ---> Eliminar una prenda
//HU03 ---> Eliminar una prenda
describe('DELETE /item/:type', () => {
it('should delete an item', (done) => {
request(app)
Expand All @@ -63,6 +84,18 @@ describe('DELETE /item/:type', () => {
})
})


//HU05 ---> Consultar un accesorio
describe('GET /accessory', () => {
it('should get all the accessories', (done) => {
request(app)
.get('/accessory')
.expect('Content-Type', /json/)
.expect(200, done());
})
})


let item = {
"type": "JACKET",
"size": "S",
Expand Down

0 comments on commit 385dfcf

Please sign in to comment.