mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 19:59:37 +00:00
26 lines
642 B
TypeScript
26 lines
642 B
TypeScript
|
|
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,
|
||
|
|
"Student Code not provided"
|
||
|
|
);
|
||
|
|
});
|
||
|
|
|
||
|
|
Deno.test("Throws with invalid student code", async () => {
|
||
|
|
const client = new StudentClient("invalid");
|
||
|
|
await assertRejects(
|
||
|
|
async () => {
|
||
|
|
await client.login();
|
||
|
|
},
|
||
|
|
Error,
|
||
|
|
"Unauthenticated: ClassCharts didn't return authentication cookies"
|
||
|
|
);
|
||
|
|
});
|