Signed-off-by: Florian BOUILLON <f.bouillon@aptatio.com>
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import { assert, expect, test } from 'vitest'
|
||||
import { comparePassword, hashPassword } from '../src/libs/AuthUtils'
|
||||
import { expect, test } from 'vitest'
|
||||
|
||||
// Edit an assertion and save to see HMR in action
|
||||
|
||||
@ -8,26 +7,3 @@ test('Math.sqrt()', () => {
|
||||
expect(Math.sqrt(144)).toBe(12);
|
||||
expect(Math.sqrt(2)).toBe(Math.SQRT2);
|
||||
});
|
||||
|
||||
test('JSON', () => {
|
||||
const input = {
|
||||
foo: 'hello',
|
||||
bar: 'world',
|
||||
};
|
||||
|
||||
const output = JSON.stringify(input);
|
||||
|
||||
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)
|
||||
})
|
||||
|
Reference in New Issue
Block a user