generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest-setup.ts
54 lines (47 loc) · 1.02 KB
/
vitest-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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { vi } from "vitest";
process.env = {
...process.env,
ENVIRONMENT_MODE: "production",
FRESHDESK_API_KEY: "test",
REDIS_URL: "test",
ZITADEL_DOMAIN: "http://test",
ZITADEL_APPLICATION_KEY: JSON.stringify({
keyId: "test",
clientId: "test",
key: "test",
}),
};
vi.mock("./src/lib/integration/databaseConnector", () => ({
DatabaseConnectorClient: {
oneOrNone: vi.fn(),
},
}));
vi.mock("./src/lib/logging/auditLogs", () => ({
auditLog: vi.fn(),
}));
vi.mock("axios", () => {
return {
default: {
post: vi.fn().mockResolvedValue({}),
},
};
});
vi.mock("node:crypto", async (importOriginal) => {
const original = (await importOriginal()) as object;
return {
...original,
createPublicKey: vi.fn(),
createPrivateKey: vi.fn(),
publicEncrypt: vi.fn(),
};
});
vi.mock("redis", () => {
const client = {
connect: vi.fn().mockResolvedValue({}),
quit: vi.fn(),
on: vi.fn().mockReturnThis(),
};
return {
createClient: vi.fn(() => client),
};
});