-
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
32e0894
commit 292a0b9
Showing
6 changed files
with
43 additions
and
2 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
Empty file.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const chai = require('chai'); | ||
const { describe, it } = require('mocha'); | ||
const sinon = require('sinon'); | ||
const chaiHttp = require('chai-http'); | ||
const app = require('../../app'); | ||
const { Sequelize } = require('../../database/models'); | ||
const { User } = require('../mocks/mockDataTransaction'); | ||
const { expect } = chai; | ||
|
||
chai.use(chaiHttp); | ||
|
||
describe('Testando o end-point /sing-in', () => { | ||
afterEach(() => { | ||
sinon.restore(); | ||
}); | ||
|
||
it('Testando o retorno em caso de requisição bem sucedida', async () => { | ||
const payload = { | ||
email: '[email protected]', | ||
password: '123456' | ||
}; | ||
|
||
sinon.stub(Sequelize.Model, 'findOne').resolves(() => User); | ||
|
||
await chai | ||
.request(app) | ||
.post('/sing-in') | ||
.send(payload); | ||
|
||
expect(User.name).to.exist; | ||
expect(User).to.be.a('object'); | ||
expect(User).to.have.property('name'); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -60,9 +60,17 @@ const inputTransaction = { | |
cardCvv: 874, | ||
} | ||
|
||
const User = { | ||
id: 1, | ||
name: "m3gan eu sou robô", | ||
lastName: null, | ||
email: '[email protected]' | ||
} | ||
|
||
module.exports = { | ||
dataReponse, | ||
dataReponsePayable, | ||
inputTransaction, | ||
outputPayable, | ||
User | ||
}; |