templates2.Store.Nuxt/tests/unit/auth.test.ts
w4c-templates 228f2f01f2
Some checks failed
CI / quality (push) Has been cancelled
chore(template): publish Store.Nuxt
2026-10-11 23:24:30 +03:00

20 lines
658 B
TypeScript

import { describe, expect, it } from 'vitest';
import { hashPassword, verifyPassword } from '#shared/password';
import { slugify } from '#shared/plans';
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');
});
});