-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a29ebe
commit e2b9f08
Showing
5 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,10 @@ const User = require('../models').User; | |
|
||
chai.use(chaiHttp); | ||
|
||
|
||
// ==> Test signup | ||
describe('Teste singUp', () => { | ||
it('Deve criar um novo usuário', (done) => { | ||
/* await User.destroy({ | ||
where: { | ||
email: "teste1@teste.com" | ||
} | ||
}); */ | ||
const body = { | ||
"nome": "Teste1", | ||
"email": "[email protected]", | ||
|
@@ -251,7 +247,45 @@ describe('Teste singIn', () => { | |
}); | ||
}); | ||
}); | ||
/* User.destroy({ | ||
where: { | ||
email: "teste1@teste.com" | ||
} | ||
}); */ | ||
describe('Teste buscar usuário', () => { | ||
it('Deve retornar o usuário', (done) => { | ||
User.findOne({ | ||
attributes: ['id', 'token'], | ||
where: { | ||
email: "[email protected]" | ||
} | ||
}).then(function (value) { | ||
console.log(value.dataValues.token); | ||
chai.request(server) | ||
.get(`/buscarUsuario/${value.dataValues.id}`) | ||
.set('token', value.dataValues.token) | ||
.end((err, res) => { | ||
res.should.have.status(200); | ||
done(); | ||
}); | ||
}); | ||
|
||
/* describe('Teste buscar usuário', () => { | ||
}); | ||
|
||
}); */ | ||
it('Deve informar que o usuário não está autorizado', (done) => { | ||
User.findOne({ | ||
attributes: ['id', 'token'], | ||
where: { | ||
email: "[email protected]" | ||
} | ||
}).then(function (value) { | ||
console.log(value.dataValues.token); | ||
chai.request(server) | ||
.get(`/buscarUsuario/${value.dataValues.id}`) | ||
.end((err, res) => { | ||
res.should.have.status(401); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters