* init * get unit test working for course.ts file * added some other tests * tests halfway + change config to accomodate js files * utility functions tests done * fix: config file + miscellaneous fixes * fix: prepare script * fix lock file --------- Co-authored-by: Rotimi Best <[email protected]>
18 lines
648 B
JavaScript
18 lines
648 B
JavaScript
import generateSlug from './generateSlug';
|
|
|
|
describe('generateSlug', () => {
|
|
test('should return a string with lowercase letters and hyphens when given a valid title', () => {
|
|
const title = 'This is a Valid Title';
|
|
const expected = 'this-is-a-valid-title' + `-${new Date().getTime()}`;
|
|
const result = generateSlug(title);
|
|
expect(result).toBe(expected);
|
|
});
|
|
|
|
test('should include the current timestamp at the end of the string', () => {
|
|
const title = 'This is a Valid Title';
|
|
const result = generateSlug(title);
|
|
const timestamp = result.split('-').pop();
|
|
expect(Number(timestamp)).toBeGreaterThan(0);
|
|
});
|
|
});
|