1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 19:59:37 +00:00
classcharts-api-js/src/core/studentClient_test.ts

26 lines
644 B
TypeScript
Raw Normal View History

2023-08-30 12:28:49 +01:00
import { assertRejects } from "https://deno.land/std@0.200.0/assert/mod.ts";
import { StudentClient } from "./studentClient.ts";
Deno.test("Throws when no student code is provided", async () => {
const client = new StudentClient("");
await assertRejects(
async () => {
await client.login();
},
Error,
2023-08-30 13:43:25 +01:00
"Student Code not provided",
2023-08-30 12:28:49 +01:00
);
});
Deno.test("Throws with invalid student code", async () => {
const client = new StudentClient("invalid");
await assertRejects(
async () => {
await client.login();
},
Error,
2023-08-30 13:43:25 +01:00
"Unauthenticated: ClassCharts didn't return authentication cookies",
2023-08-30 12:28:49 +01:00
);
});