utils/ts-src/kebabCase.test.ts

26 lines
670 B
TypeScript
Raw Normal View History

import { kebabCase } from './kebabCase';
test('Null instead of string', function() {
expect(kebabCase(null)).toBe('');
});
test('Empty string', function() {
expect(kebabCase('')).toBe('');
});
test('String with spaces', function() {
expect(kebabCase('test string')).toBe('test-string');
});
test('String with Capitals', function() {
expect(kebabCase('testString')).toBe('test-string');
});
test('String with underscores', function() {
expect(kebabCase('test_string')).toBe('test-string');
});
test('String with spaces, underscores and capitals', function() {
expect(kebabCase('this is a_complexTest_String')).toBe('this-is-a-complex-test-string');
});