Files
tolaria/src/utils/noteSlug.test.ts
2026-04-25 23:08:30 +02:00

19 lines
647 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest'
import { slugifyNoteStem } from './noteSlug'
describe('slugifyNoteStem', () => {
it('slugifies ASCII titles into lowercase path stems', () => {
expect(slugifyNoteStem('Weekly Review')).toBe('weekly-review')
})
it('preserves Unicode letters and digits', () => {
expect(slugifyNoteStem('你好')).toBe('你好')
expect(slugifyNoteStem('My Note 你好')).toBe('my-note-你好')
})
it('falls back to untitled when the title has no alphanumeric characters', () => {
expect(slugifyNoteStem('+++')).toBe('untitled')
expect(slugifyNoteStem('')).toBe('untitled')
})
})