Files
Webklar-Kundenbereich/test/slug.test.js
T
2026-09-30 10:21:34 +00:00

19 lines
694 B
JavaScript
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 { test } from 'node:test'
import assert from 'node:assert/strict'
import { slugify } from '../server/services/slug.js'
test('Umlaute', () => {
assert.equal(slugify('Döner Nation'), 'doener-nation')
assert.equal(slugify('Größe Überall Ärger'), 'groesse-ueberall-aerger')
})
test('Apostrophe entfallen', () => {
assert.equal(slugify("Emma's Schatzkiste"), 'emmas-schatzkiste')
assert.equal(slugify('Emma’s'), 'emmas')
})
test('Akzente', () => assert.equal(slugify('Café Élan'), 'cafe-elan'))
test('Sonderzeichen, Ränder, Länge', () => {
assert.equal(slugify('--A&B--'), 'a-b')
assert.equal(slugify('x'.repeat(150)).length, 100)
assert.equal(slugify(null), '')
})