added test for slugify w/ burnettk
This commit is contained in:
parent
020851245b
commit
7a313c9814
|
@ -5,7 +5,8 @@ export const slugifyString = (str) => {
|
|||
.trim()
|
||||
.replace(/[^\w\s-]/g, '')
|
||||
.replace(/[\s_-]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
.replace(/^-+/g, '')
|
||||
.replace(/-+$/g, '');
|
||||
};
|
||||
|
||||
export const convertDateToSeconds = (date, onChangeFunction) => {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { slugifyString } from './helpers';
|
||||
|
||||
test('it can slugify a string', () => {
|
||||
expect(slugifyString("hello-world_ and then Some such-")).toEqual('hello-world-and-then-some-such');
|
||||
});
|
Loading…
Reference in New Issue