20 lines
654 B
TypeScript
20 lines
654 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { hashPassword, verifyPassword } from '@/lib/password';
|
|
import { slugify } from '@/lib/utils';
|
|
|
|
describe('password hashing', () => {
|
|
it('round-trips a password', async () => {
|
|
const hash = await hashPassword('password');
|
|
expect(hash).not.toBe('password');
|
|
expect(await verifyPassword('password', hash)).toBe(true);
|
|
expect(await verifyPassword('wrong', hash)).toBe(false);
|
|
});
|
|
});
|
|
|
|
describe('slugify', () => {
|
|
it('produces a url-safe slug', () => {
|
|
expect(slugify('Hello, World!')).toBe('hello-world');
|
|
expect(slugify(' Already-slug ')).toBe('already-slug');
|
|
});
|
|
});
|