Skip to content

Commit 481a364

Browse files
committed
Refatora Teste Unitário
1 parent b1274ab commit 481a364

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

server/modules/User/unit.test.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ var service_1 = require('./service');
44
describe('Testes unitários no Service User', function () {
55
describe('Create Method', function () {
66
it('Should create an User', function () {
7-
var user = { create: helpers_1.testDouble.function() };
7+
// const user = { create: testDouble.function() };
88
var requestUser = {
99
id: 100,
1010
name: 'Raphael Lima',
1111
1212
password: '123'
1313
};
14-
var expectedResponse = {
15-
id: 100,
16-
name: 'Raphael Lima',
17-
18-
password: '123'
19-
};
20-
helpers_1.testDouble.when(user.create(requestUser)).thenResolve(expectedResponse);
14+
// const expectedResponse = {
15+
// id: 100,
16+
// name: 'Raphael Lima',
17+
// email: '[email protected]',
18+
// password: '123'
19+
// };
20+
//
21+
// testDouble.when(user.create(requestUser)).thenResolve(expectedResponse);
2122
var userService = new service_1.User();
2223
return userService
2324
.create(requestUser)

server/modules/User/unit.test.ts

-9
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,12 @@ import { User } from './service';
66
describe('Testes unitários no Service User', () => {
77
describe('Create Method', () => {
88
it('Should create an User', () => {
9-
const user = { create: testDouble.function() };
109
const requestUser = {
1110
id: 100,
1211
name: 'Raphael Lima',
1312
1413
password: '123'
1514
};
16-
const expectedResponse = {
17-
id: 100,
18-
name: 'Raphael Lima',
19-
20-
password: '123'
21-
};
22-
23-
testDouble.when(user.create(requestUser)).thenResolve(expectedResponse);
2415
const userService = new User();
2516
return userService
2617
.create(requestUser)

0 commit comments

Comments
 (0)