Skip to content

Commit 13abdca

Browse files
committed
Fix unit tests
1 parent 635fb36 commit 13abdca

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

tests/unit/functions/github.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("createGithubTeam", () => {
5353

5454
const result = await createGithubTeam(defaultInputs);
5555

56-
expect(result).toBe(existingTeamId);
56+
expect(result).toStrictEqual({ updated: false, id: existingTeamId });
5757
expect(mockLogger.info).toHaveBeenCalledWith(
5858
`Team "Test Team" already exists with id: ${existingTeamId}`
5959
);
@@ -81,7 +81,7 @@ describe("createGithubTeam", () => {
8181

8282
const result = await createGithubTeam(defaultInputs);
8383

84-
expect(result).toBe(newTeamId);
84+
expect(result).toStrictEqual({ updated: true, id: newTeamId });
8585
expect(mockOctokit.request).toHaveBeenCalledWith("POST /orgs/{org}/teams", {
8686
org: "test-org",
8787
name: "Test Team",
@@ -157,7 +157,7 @@ describe("createGithubTeam", () => {
157157

158158
const result = await createGithubTeam(defaultInputs);
159159

160-
expect(result).toBe(newTeamId);
160+
expect(result).toStrictEqual({ updated: true, id: newTeamId });
161161
expect(mockLogger.warn).toHaveBeenCalledWith(
162162
`Failed to remove user from team ${newTeamId}:`,
163163
expect.any(Error)

tests/unit/organizations.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ import { createJwt } from "./auth.test.js";
1616
import { marshall } from "@aws-sdk/util-dynamodb";
1717
import { genericConfig } from "../../src/common/config.js";
1818
import { randomUUID } from "node:crypto";
19-
import { createGithubTeam } from "../../src/api/functions/github.js";
20-
import { addLead, removeLead } from "../../src/api/functions/organizations.js";
21-
import { modifyGroup } from "../../src/api/functions/entraId.js";
2219

2320
const app = await init();
2421
const ddbMock = mockClient(DynamoDBClient);
@@ -48,17 +45,6 @@ vi.mock("../../src/api/functions/entraId.js", () => {
4845
}),
4946
};
5047
});
51-
vi.mock("../../src/api/functions/github.js", () => {
52-
return {
53-
...vi.importActual("../../src/api/functions/github.js"),
54-
createGithubTeam: vi.fn().mockImplementation(async () => {
55-
return randomUUID();
56-
}),
57-
assignIdpGroupsToTeam: vi.fn().mockImplementation(async () => {
58-
return;
59-
}),
60-
};
61-
});
6248

6349
const acmMeta = {
6450
primaryKey: "DEFINE#ACM",
@@ -417,16 +403,6 @@ describe("Organization info tests - Extended Coverage", () => {
417403
expect(
418404
ddbMock.commandCalls(TransactWriteItemsCommand).length,
419405
).toBeGreaterThan(0);
420-
expect(createGithubTeam).toHaveBeenCalledOnce();
421-
expect(createGithubTeam).toHaveBeenCalledWith(
422-
expect.objectContaining({
423-
githubToken: "abc123testing",
424-
orgId: "acm-uiuc-testing",
425-
name: "social-adm-nonprod",
426-
description: "Social Committee Admin",
427-
parentTeamId: 14420860,
428-
}),
429-
);
430406
});
431407

432408
test("Successfully adds and removes Officers but skips Entra + GitHub integration", async () => {
@@ -489,8 +465,6 @@ describe("Organization info tests - Extended Coverage", () => {
489465
expect(
490466
ddbMock.commandCalls(TransactWriteItemsCommand).length,
491467
).toBeGreaterThan(0);
492-
expect(createGithubTeam).toHaveBeenCalledTimes(0);
493-
expect(modifyGroup).toHaveBeenCalledTimes(0);
494468
});
495469

496470
test("Organization lead can manage other leads", async () => {

0 commit comments

Comments
 (0)