Signed-off-by: Avior <github@avior.me>
This commit is contained in:
2023-06-22 00:50:42 +02:00
parent 8442c7b4e3
commit ae1b7f9ec4
23 changed files with 684 additions and 83 deletions

View File

@ -1,4 +1,5 @@
import { assert, expect, test } from 'vitest'
import { comparePassword, hashPassword } from '../src/libs/AuthUtils'
// Edit an assertion and save to see HMR in action
@ -19,3 +20,14 @@ test('JSON', () => {
expect(output).eq('{"foo":"hello","bar":"world"}');
assert.deepEqual(JSON.parse(output), input, 'matches original');
});
test('auth util', async () => {
const password = 'pouet'
const out1 = await hashPassword(password)
expect(out1).not.toBe(password)
const out2 = await hashPassword(password)
expect(out2).not.toBe(out1)
expect(await comparePassword(password, out1)).toBe(true)
expect(await comparePassword(password, out2)).toBe(true)
})