mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 11:58:13 +00:00
chore: format
This commit is contained in:
parent
eb327bbbeb
commit
4af17dfa2d
2 changed files with 20 additions and 22 deletions
|
|
@ -45,7 +45,7 @@ export class ParentClient extends BaseClient {
|
||||||
if (response.status != 302 || !response.headers.has("set-cookie")) {
|
if (response.status != 302 || !response.headers.has("set-cookie")) {
|
||||||
await response.body?.cancel(); // Make deno tests happy by closing the body, unsure whether this is needed for the actual library
|
await response.body?.cancel(); // Make deno tests happy by closing the body, unsure whether this is needed for the actual library
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Unauthenticated: ClassCharts didn't return authentication cookies"
|
"Unauthenticated: ClassCharts didn't return authentication cookies",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { assertRejects } from "~/deps_dev.ts";
|
||||||
import { ParentClient } from "~/src/core/parentClient.ts";
|
import { ParentClient } from "~/src/core/parentClient.ts";
|
||||||
|
|
||||||
Deno.test("Throws when no email is provided", async () => {
|
Deno.test("Throws when no email is provided", async () => {
|
||||||
const client = new ParentClient("","password");
|
const client = new ParentClient("", "password");
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
async () => {
|
async () => {
|
||||||
await client.login();
|
await client.login();
|
||||||
|
|
@ -14,7 +14,7 @@ Deno.test("Throws when no email is provided", async () => {
|
||||||
|
|
||||||
// throws when no password is provided
|
// throws when no password is provided
|
||||||
Deno.test("Throws when no password is provided", async () => {
|
Deno.test("Throws when no password is provided", async () => {
|
||||||
const client = new ParentClient("email","");
|
const client = new ParentClient("email", "");
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
async () => {
|
async () => {
|
||||||
await client.login();
|
await client.login();
|
||||||
|
|
@ -22,11 +22,10 @@ Deno.test("Throws when no password is provided", async () => {
|
||||||
Error,
|
Error,
|
||||||
"Password not provided",
|
"Password not provided",
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
Deno.test("Throws with invalid login", async () => {
|
Deno.test("Throws with invalid login", async () => {
|
||||||
const client = new ParentClient("invalid","invalid");
|
const client = new ParentClient("invalid", "invalid");
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
async () => {
|
async () => {
|
||||||
await client.login();
|
await client.login();
|
||||||
|
|
@ -34,5 +33,4 @@ Deno.test("Throws with invalid login", async () => {
|
||||||
Error,
|
Error,
|
||||||
"Unauthenticated: ClassCharts didn't return authentication cookies",
|
"Unauthenticated: ClassCharts didn't return authentication cookies",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue