mirror of
https://github.com/kremalicious/blog.git
synced 2024-06-28 16:48:00 +02:00
24 lines
702 B
TypeScript
24 lines
702 B
TypeScript
import { test, expect } from 'vitest'
|
|
import { slugify, slugifyAll } from '.'
|
|
|
|
test('slugify should convert text to slug', () => {
|
|
const text = 'Hello World!'
|
|
const expected = 'hello-world'
|
|
const result = slugify(text)
|
|
expect(result).toBe(expected)
|
|
})
|
|
|
|
test('slugify should remove special characters', () => {
|
|
const text = 'Hello*+~.()\'"!:@ World!'
|
|
const expected = 'hello-world'
|
|
const result = slugify(text)
|
|
expect(result).toBe(expected)
|
|
})
|
|
|
|
test('slugifyAll should convert an array of texts to slugs', () => {
|
|
const texts = ['Hello World!', 'Another Text']
|
|
const expected = ['hello-world', 'another-text']
|
|
const result = slugifyAll(texts)
|
|
expect(result).toEqual(expected)
|
|
})
|