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:
Toyin Muhammed
2023-12-20 14:28:40 +03:00
committed by GitHub
co-authored by Rotimi Best
parent 4b2e58b1de
commit 6d689ede45
24 changed files with 2293 additions and 35 deletions
@@ -0,0 +1,28 @@
import { capitalizeFirstLetter } from './string';
describe('capitalize first letter', () => {
test('should return the same string with the first letter capitalized', () => {
const result = capitalizeFirstLetter('classroom');
expect(result).toEqual('Classroom');
});
test('should return an empty string when given an empty string', () => {
const result = capitalizeFirstLetter('');
expect(result).toEqual('');
});
test('should return the same string when given a string with all uppercase letters', () => {
const result = capitalizeFirstLetter('UPPERCASE');
expect(result).toEqual('UPPERCASE');
});
test('should return the same string when given a string with a non-alphabetical first character', () => {
const result = capitalizeFirstLetter('123abc');
expect(result).toEqual('123abc');
});
test('should return the first letter of the first word capitalized when given a sentence', () => {
const result = capitalizeFirstLetter('classroomio is an open source project');
expect(result).toEqual('Classroomio is an open source project');
});
});