Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
test: 🚨 add regression test for #83
Browse files Browse the repository at this point in the history
  • Loading branch information
ecxyzzy committed Aug 26, 2023
1 parent 45a98d5 commit aa31141
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/api/src/tests/v1/rest/grades.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { assert, describe, expect, it } from "vitest";

describe("/v1/rest/grades tests", () => {
it("returns zeros for nonexistent aggregate", async () => {
const res = await get("/v1/rest/grades/aggregate?year=2013");
assert("payload" in res);
expect(res.payload).toHaveProperty("sectionList", []);
assert(typeof res.payload === "object");
assert(res.payload !== null);
assert("gradeDistribution" in res.payload);
expect(res.payload.gradeDistribution).toHaveProperty("gradeACount", 0);
expect(res.payload.gradeDistribution).toHaveProperty("gradeBCount", 0);
expect(res.payload.gradeDistribution).toHaveProperty("gradeCCount", 0);
expect(res.payload.gradeDistribution).toHaveProperty("gradeDCount", 0);
expect(res.payload.gradeDistribution).toHaveProperty("gradeFCount", 0);
expect(res.payload.gradeDistribution).toHaveProperty("gradePCount", 0);
expect(res.payload.gradeDistribution).toHaveProperty("gradeNPCount", 0);
expect(res.payload.gradeDistribution).toHaveProperty("gradeWCount", 0);
expect(res.payload.gradeDistribution).toHaveProperty("averageGPA", 0);
});
});

0 comments on commit aa31141

Please sign in to comment.