polish-validators
Version:
A set of validator functions that check common polish numbers.
23 lines (22 loc) • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const doctor_1 = require("./doctor");
describe('isDoctorNumberValid', () => {
it('should return false if the number contains non-digit characters', () => {
expect((0, doctor_1.isDoctorNumberValid)('A234567')).toBe(false);
});
it('should return false if the number does not have exactly 7 digits', () => {
expect((0, doctor_1.isDoctorNumberValid)('123456')).toBe(false);
expect((0, doctor_1.isDoctorNumberValid)('12345678')).toBe(false);
});
it('should return true for a valid doctor number', () => {
expect((0, doctor_1.isDoctorNumberValid)('1234567')).toBe(true);
});
it('should return false for a doctor number that fails the checksum validation', () => {
expect((0, doctor_1.isDoctorNumberValid)('2234567')).toBe(false);
});
it('should have isDoctorNumberInvalid return the inverse of isDoctorNumberValid', () => {
expect((0, doctor_1.isDoctorNumberInvalid)('1234567')).toBe(false);
expect((0, doctor_1.isDoctorNumberInvalid)('2234567')).toBe(true);
});
});