Files
2026-03-26 11:54:42 -05:00

21 lines
551 B
TypeScript

import { describe, it, expect } from 'vitest';
import { slugify } from '$lib/slugify';
describe('slugify', () => {
it('converts to lowercase with hyphens', () => {
expect(slugify('Hello World')).toBe('hello-world');
});
it('removes special characters', () => {
expect(slugify("Buddy's Adventure!")).toBe('buddys-adventure');
});
it('collapses multiple hyphens', () => {
expect(slugify('foo bar---baz')).toBe('foo-bar-baz');
});
it('trims leading and trailing hyphens', () => {
expect(slugify(' hello ')).toBe('hello');
});
});