b90ff252d1
Public archive with sidebar navigation, project pages, month archive, search and entry pages with image blocks. Admin area for brands, projects, post types, users, api clients, media and the entry editor with drag and drop images, preview per audience, scheduling and publish checks. Read and write API with bearer tokens, audience scoping, idempotent creation, OpenAPI document and editorial guide. Magic link login with configurable allowed domains, whole app behind the session gate. 456 tests including design rule checks.
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { isSlug, slugify } from '~/domain/slug'
|
|
|
|
describe('slugify', () => {
|
|
it('macht aus einem Namen einen Slug', () => {
|
|
expect(slugify('MTA Telematik')).toBe('mta-telematik')
|
|
})
|
|
|
|
it('schreibt Umlaute aus', () => {
|
|
expect(slugify('Größe und Öl')).toBe('groesse-und-oel')
|
|
})
|
|
|
|
it('wirft Sonderzeichen weg und lässt keine Bindestriche am Rand', () => {
|
|
expect(slugify(' Trakk / Regel-Engine! ')).toBe('trakk-regel-engine')
|
|
})
|
|
|
|
it('liefert eine leere Zeichenkette, wenn nichts Verwertbares übrig bleibt', () => {
|
|
expect(slugify('///')).toBe('')
|
|
})
|
|
})
|
|
|
|
describe('isSlug', () => {
|
|
it('nimmt Kleinbuchstaben, Ziffern und Bindestriche an', () => {
|
|
expect(isSlug('mta-360')).toBe(true)
|
|
})
|
|
|
|
it('lehnt Großbuchstaben ab', () => {
|
|
expect(isSlug('Trakk')).toBe(false)
|
|
})
|
|
|
|
it('lehnt führende und doppelte Bindestriche ab', () => {
|
|
expect(isSlug('-trakk')).toBe(false)
|
|
expect(isSlug('trakk--web')).toBe(false)
|
|
})
|
|
|
|
it('lehnt einen zu kurzen Slug ab', () => {
|
|
expect(isSlug('a')).toBe(false)
|
|
})
|
|
})
|