We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 190b0a1 commit 1893050Copy full SHA for 1893050
src/infra/criptography/bcrypt-adapter.spec.ts
@@ -6,17 +6,21 @@ jest.mock('bcrypt', () => ({
6
}
7
8
}))
9
+
10
+const salt = 12
11
+const makeSut = (): BcryptAdapter => {
12
+ return new BcryptAdapter(salt)
13
+}
14
15
describe('Bcrypt Adapter', () => {
16
test('Should call bcrypt with correct values', async () => {
- const salt = 12
- const sut = new BcryptAdapter(salt)
17
+ const sut = makeSut()
18
const hashSpy = jest.spyOn(bcrypt, 'hash')
19
await sut.encrypt('any_value')
20
expect(hashSpy).toHaveBeenCalledWith('any_value', salt)
21
})
22
test('Should return a hash on success', async () => {
23
24
const hash = await sut.encrypt('any_value')
25
expect(hash).toBe('hash')
26
0 commit comments