feat(MED-161): add jest for service tests
This commit is contained in:
44
__mocks__/isikukood.ts
Normal file
44
__mocks__/isikukood.ts
Normal 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
3
__mocks__/server-only.ts
Normal 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 {};
|
||||
Reference in New Issue
Block a user