From 7ef60e1ff8625e5fa0e705f72c4729c594004da6 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 8 Oct 2024 20:42:40 -0500 Subject: [PATCH 1/2] add comms --- src/orgs.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/orgs.ts b/src/orgs.ts index 25142569..ba1091eb 100644 --- a/src/orgs.ts +++ b/src/orgs.ts @@ -16,12 +16,15 @@ export const SIGList = [ "SIGPolicy", "SIGARCH", "SIGRobotics", + "SIGtricity", ] as const; export const CommitteeList = [ "Infrastructure Committee", "Social Committee", "Mentorship Committee", - "Academic Committee" + "Academic Committee", + "Corporate Committee", + "Marketing Committee", ] as const; export const OrganizationList = ["ACM", ...SIGList, ...CommitteeList]; From 136eafc0defffce10a474aad3d3febfa873cf7a5 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Tue, 8 Oct 2024 20:54:38 -0500 Subject: [PATCH 2/2] add tests --- tests/live/organizations.test.ts | 18 ++++++++++++++++++ tests/unit/organizations.test.ts | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/live/organizations.test.ts create mode 100644 tests/unit/organizations.test.ts diff --git a/tests/live/organizations.test.ts b/tests/live/organizations.test.ts new file mode 100644 index 00000000..f82bbf70 --- /dev/null +++ b/tests/live/organizations.test.ts @@ -0,0 +1,18 @@ +import { expect, test } from "vitest"; +import { InternalServerError } from "../../src/errors/index.js"; + +const appKey = process.env.APPLICATION_KEY; +if (!appKey) { + throw new InternalServerError({ message: "No application key found" }); +} + +const baseEndpoint = `https://${appKey}.aws.qa.acmuiuc.org`; + +test("getting organizations", async () => { + const response = await fetch(`${baseEndpoint}/api/v1/organizations`); + expect(response.status).toBe(200); + const responseJson = (await response.json()) as string[]; + expect(responseJson.length).greaterThan(0); + expect(responseJson).toContain("ACM"); + expect(responseJson).toContain("Infrastructure Committee"); +}); diff --git a/tests/unit/organizations.test.ts b/tests/unit/organizations.test.ts new file mode 100644 index 00000000..78bbc985 --- /dev/null +++ b/tests/unit/organizations.test.ts @@ -0,0 +1,15 @@ +import { afterAll, expect, test } from "vitest"; +import init from "../../src/index.js"; + +const app = await init(); +test("Test getting the list of organizations succeeds", async () => { + const response = await app.inject({ + method: "GET", + url: "/api/v1/organizations", + }); + expect(response.statusCode).toBe(200); + const responseDataJson = await response.json(); +}); +afterAll(async () => { + await app.close(); +});