-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.setup.ts
33 lines (28 loc) · 914 Bytes
/
jest.setup.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const authLib = jest.requireActual('@frmscoe/auth-lib');
class MockAuthenticationService {
getToken(u: string, p: string): Promise<string> {
if (u === 'blank') {
return Promise.resolve('');
} else if (u === 'reject') {
return Promise.reject('REJECT');
} else {
return Promise.resolve(`${u}${p}`);
}
}
}
const mockedAuthLib = { ...authLib, AuthenticationService: MockAuthenticationService };
jest.mock('@frmscoe/auth-lib', () => mockedAuthLib);
jest.mock('@tazama-lf/frms-coe-lib/lib/config', () => ({
validateEnvVar: jest.fn().mockReturnValue(''),
}));
jest.mock('@tazama-lf/frms-coe-lib/lib/config', () => ({
validateEnvVar: jest.fn().mockReturnValue(''),
validateProcessorConfig: jest.fn().mockReturnValue({
maxCPU: 1,
functionName: 'auth-test',
nodeEnv: 'test'
}),
validateLogConfig: jest.fn().mockReturnValue({
logstashLevel: '',
}),
}));