refactor: Some path refactoring
This commit is contained in:
@@ -16,6 +16,7 @@ import fs from "fs";
|
||||
import parseAbsence from "../scrape/utils/parseAbsence.js";
|
||||
|
||||
const teachermap: Record<string, string> = JSON.parse(fs.readFileSync("./tests/teachermap.json", "utf8"));
|
||||
let passedAll = true;
|
||||
|
||||
test("Me", [
|
||||
{
|
||||
@@ -262,6 +263,7 @@ function test(input: string, expectedOutput: any[]) {
|
||||
const res = parseAbsence(input, teachermap);
|
||||
|
||||
if (!deepEqual(res, expectedOutput)) {
|
||||
passedAll = false;
|
||||
console.error("ERROR for input: " + input);
|
||||
console.log(JSON.stringify(res, null, 2));
|
||||
console.log(JSON.stringify(expectedOutput, null, 2));
|
||||
@@ -308,3 +310,7 @@ function deepEqual(a: any, b: any): boolean {
|
||||
|
||||
return keysA.every((key) => keysB.includes(key) && deepEqual(a[key], b[key]));
|
||||
}
|
||||
|
||||
if (passedAll) {
|
||||
console.log("All tests passed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user