fet: Add changes lol

Signed-off-by: Florian BOUILLON <f.bouillon@aptatio.com>
This commit is contained in:
2023-06-28 17:30:18 +02:00
parent 9530be5c43
commit ff07f8f4a5
24 changed files with 656 additions and 511 deletions

View 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)
})
})