feat(MED-161): add jest for service tests

This commit is contained in:
2025-09-17 11:17:50 +03:00
parent 64acdfcbbb
commit 4302ddb90e
8 changed files with 1503 additions and 344 deletions

44
__mocks__/isikukood.ts Normal file
View File

@@ -0,0 +1,44 @@
// Mock for isikukood library to avoid ES module issues in tests
export enum Gender {
MALE = 'male',
FEMALE = 'female',
}
export default class Isikukood {
private code: string;
constructor(code: string) {
this.code = code;
}
static validate(code: string): boolean {
return true; // Mock always returns true for tests
}
static generate(options?: { gender?: Gender; century?: number }): string {
return '39001010002'; // Mock Estonian ID code
}
isValid(): boolean {
return true;
}
getGender(): Gender {
return Gender.MALE;
}
getBirthDate(): Date {
return new Date('1990-01-01');
}
getAge(): number {
return 30;
}
getCentury(): number {
return 3;
}
}
export { Isikukood };

3
__mocks__/server-only.ts Normal file
View File

@@ -0,0 +1,3 @@
// Mock for server-only to avoid Next.js server component issues in tests
// This module does nothing in tests - it's just a marker for Next.js
export {};