Skip to content

Commit f7e0ed9

Browse files
committed
test: ensure BcryptAdapter calls bcrypt with correct values
1 parent af041f7 commit f7e0ed9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { BcryptAdapter } from './bcrypt-adapter'
2+
import bcrypt from 'bcrypt'
3+
describe('Bcrypt Adapter', () => {
4+
test('Should call bcrypt with correct values', async () => {
5+
const salt = 12
6+
const sut = new BcryptAdapter(salt)
7+
const hashSpy = jest.spyOn(bcrypt, 'hash')
8+
await sut.encrypt('any_value')
9+
expect(hashSpy).toHaveBeenCalledWith('any_value', salt)
10+
})
11+
})

0 commit comments

Comments
 (0)