templates2.Admin.Next/tests/unit/auth.test.ts
w4c-templates c64f7ffa9e
Some checks failed
CI / quality (push) Has been cancelled
chore(template): publish Admin.Next
2026-10-11 23:25:34 +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');
});
});