templates2.Base.Next/tests/unit/auth.test.ts
w4c-templates 219be916cb
Some checks are pending
CI / quality (push) Waiting to run
chore(template): publish Base.Next
2026-10-11 23:23:30 +03:00

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');
});
});