* refactor: use fastify vite for the server by doing this we do not need to have local hacks for the routes. No local proxy needed. Everything just works. * fix: update the dockerfile build path * fix: update package.json * fix: fonts path
24 lines
831 B
JavaScript
24 lines
831 B
JavaScript
import assert from 'assert';
|
|
|
|
import { compare, hash } from '../../../server/helpers/password.js';
|
|
|
|
const PASSWORD = 'suP3rL0ng!PssWrd';
|
|
|
|
describe('Password', () => {
|
|
describe('#hash(password), #compare(password, hash)', () => {
|
|
it('should hash as password, then compare it to be true', async () => {
|
|
const hashedPassword = await hash(PASSWORD);
|
|
assert.equal(typeof hashedPassword, 'string');
|
|
|
|
assert.equal(await compare(PASSWORD, hashedPassword), true);
|
|
});
|
|
|
|
it('should hash as password, then compare it to be false', async () => {
|
|
const hashedPassword = await hash(PASSWORD);
|
|
assert.equal(typeof hashedPassword, 'string');
|
|
|
|
assert.equal(await compare(PASSWORD + 'wrong_password', hashedPassword), false);
|
|
});
|
|
});
|
|
});
|