Files
classroomio/apps/dashboard/src/lib/utils/functions/validateEmail.spec.js
T
Toyin MuhammedandRotimi Best 6d689ede45 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 <[email protected]>
2023-12-20 14:28:40 +03:00

29 lines
882 B
JavaScript

import { validateEmail } from './validateEmail';
describe('validate email', () => {
test('should return true for a valid email format', () => {
const result = validateEmail('[email protected]');
expect(result).toBeTruthy();
});
test('should return false for an empty email', () => {
const result = validateEmail('');
expect(result).toBeFalsy();
});
test('should return true for a valid email with uppercase letters', () => {
const result = validateEmail('[email protected]');
expect(result).toBeTruthy();
});
test('should return false for an invalid email format', () => {
const result = validateEmail('test@example');
expect(result).toBeFalsy();
});
test('should return true for a valid email with special characters', () => {
const result = validateEmail('[email protected]');
expect(result).toBeTruthy();
});
});