fet: Add changes lol
Signed-off-by: Florian BOUILLON <f.bouillon@aptatio.com>
This commit is contained in:
22
tests/libs/authUtils.test.ts
Normal file
22
tests/libs/authUtils.test.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { comparePassword, hashPassword } from '../../src/libs/AuthUtils'
|
||||
|
||||
|
||||
describe('AuthUtils', () => {
|
||||
it('should hash the password', async () => {
|
||||
expect(await hashPassword('test')).toBeDefined()
|
||||
})
|
||||
|
||||
it('should compared succeffully password', async () => {
|
||||
const pass = 'test'
|
||||
const hash = await hashPassword(pass)
|
||||
expect(await comparePassword(pass, hash)).toBe(true)
|
||||
})
|
||||
|
||||
it('should not generate twice the same hash', async () => {
|
||||
const pass = 'test'
|
||||
const hash1 = await hashPassword(pass)
|
||||
const hash2 = await hashPassword(pass)
|
||||
expect(hash1).not.toBe(hash2)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user