Skip to content

Commit f4a9460

Browse files
committed
fix unit tests
1 parent eb53057 commit f4a9460

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

tests/unit/entraGroupManagement.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ describe("Test Modify Group and List Group Routes", () => {
6969
7070
"test-group-id",
7171
EntraGroupActions.ADD,
72+
expect.any(Object), // Matches any object
7273
);
74+
7375
expect(modifyGroup).toHaveBeenNthCalledWith(
7476
2,
7577
"ey.test.token",
7678
7779
"test-group-id",
7880
EntraGroupActions.REMOVE,
81+
expect.any(Object), // Matches any object
7982
);
8083
expect(response.body.success).toEqual([
8184
{ email: "[email protected]" },

tests/unit/mobileWallet.test.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,6 @@ import { v4 as uuidv4 } from "uuid";
1313
const smMock = mockClient(SecretsManagerClient);
1414
const sqsMock = mockClient(SQSClient);
1515

16-
vi.mock("../../src/api/functions/membership.js", () => {
17-
return {
18-
checkPaidMembership: vi.fn(
19-
(_endpoint: string, _log: any, netId: string) => {
20-
if (netId === "valid") {
21-
return true;
22-
}
23-
return false;
24-
},
25-
),
26-
};
27-
});
28-
2916
vi.mock("../../src/api/functions/entraId.js", () => {
3017
return {
3118
getEntraIdToken: vi.fn().mockImplementation(async () => {

tests/unit/vitest.setup.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,21 @@ vi.mock(
4444
};
4545
},
4646
);
47+
48+
vi.mock(
49+
import("../../src/api/functions/membership.js"),
50+
async (importOriginal) => {
51+
const mod = await importOriginal();
52+
return {
53+
...mod,
54+
checkPaidMembershipFromTable: vi.fn(async (netId, _dynamoClient) => {
55+
switch (netId) {
56+
case "valid":
57+
return true;
58+
default:
59+
return false;
60+
}
61+
}),
62+
};
63+
},
64+
);

0 commit comments

Comments
 (0)