added test for slugify w/ burnettk

This commit is contained in:
jasquat 2022-06-27 15:08:08 -04:00
parent 020851245b
commit 7a313c9814
2 changed files with 7 additions and 1 deletions

View File

@ -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) => {

5
src/helpers.test.js Normal file
View File

@ -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');
});