feat: unit tests for utils (#92)
* 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 <best@classroomio.com>
This commit is contained in:
co-authored by
Rotimi Best
parent
4b2e58b1de
commit
6d689ede45
@@ -0,0 +1,26 @@
|
||||
import generateUUID from './generateUUID';
|
||||
import { isUUID } from './isUUID';
|
||||
|
||||
// This test suite tests both the generateUUID and isUUID functions
|
||||
describe('GenerateUUID', () => {
|
||||
test('should be true when tested with the uuid function', () => {
|
||||
const result = generateUUID();
|
||||
expect(isUUID(result)).toBe(true);
|
||||
});
|
||||
|
||||
test('should generate unique UUIDs each time', () => {
|
||||
const uuid1 = generateUUID();
|
||||
const uuid2 = generateUUID();
|
||||
expect(uuid1).not.toBe(uuid2);
|
||||
});
|
||||
|
||||
test('should return true for a valid UUID', () => {
|
||||
const uuid = '123e4567-e89b-12d3-a456-426614174000';
|
||||
expect(isUUID(uuid)).toBe(true);
|
||||
});
|
||||
|
||||
test('should return false for an invalid UUID', () => {
|
||||
const uuid = 'invalid-uuid';
|
||||
expect(isUUID(uuid)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user