1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 11:58:13 +00:00

fix: use jsr imports

This commit is contained in:
James Cook 2024-05-28 14:32:57 +01:00
parent d357afffb6
commit e3924f0322
8 changed files with 235 additions and 29 deletions

View file

@ -1,4 +1,4 @@
import { assertRejects } from "../../deps_dev.ts";
import { assertRejects } from "@std/assert";
import { ParentClient } from "../core/parentClient.ts";
Deno.test("Throws when no email is provided", async () => {

View file

@ -1,4 +1,4 @@
import { assertRejects } from "../../deps_dev.ts";
import { assertRejects } from "@std/assert";
import { StudentClient } from "../core/studentClient.ts";
Deno.test("Throws when no student code is provided", async () => {

View file

@ -8,12 +8,9 @@ export function parseCookies(input: string) {
const cookies = input.split(",");
for (const cookie of cookies) {
const cookieSplit = cookie.split(";")[0].split("=");
output[leftTrim(decodeURIComponent(cookieSplit[0]))] = decodeURIComponent(
output[decodeURIComponent(cookieSplit[0]).trimStart()] = decodeURIComponent(
cookieSplit[1],
);
}
return output;
}
export function leftTrim(str: string) {
return str.replace(/^\s+/g, "");
}

View file

@ -1,4 +1,4 @@
import { assertEquals, assertExists } from "../../deps_dev.ts";
import { assertEquals, assertExists } from "@std/assert";
import { parseCookies } from "./utils.ts";
Deno.test("Parses simple cookie", () => {
const cookie =
@ -22,16 +22,3 @@ Deno.test("Parses cookie with no value", () => {
assertExists(parsed.cookieWithNoValue);
assertEquals(parsed.cookieWithNoValue, "");
});
import { leftTrim } from "./utils.ts";
Deno.test("Trims left with spaces", () => {
const input = " Hello world!";
const output = leftTrim(input);
assertEquals(output, "Hello world!");
});
Deno.test("Trims left with no spaces", () => {
const input = "Hello world!";
const output = leftTrim(input);
assertEquals(output, "Hello world!");
});