forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits

exam-weight.test.ts20 lines, 624 bytesHistoryRawDownload
1import { expect, test } from "vitest";
2import { examWeight } from "./exam-weight";
3
4const kinds = [
5 { name: "quiz", weight: 2 },
6 { name: "final", weight: 5 },
7];
8
9test("a direct weight (marks report) wins over the settings lookup", () => {
10 expect(examWeight({ kind: "quiz", weight: 7 }, kinds)).toBe(7);
11});
12
13test("without a direct weight, the exam kind resolves through settings", () => {
14 expect(examWeight({ kind: "final" }, kinds)).toBe(5);
15});
16
17test("unknown kind and no weight yields null", () => {
18 expect(examWeight({ kind: "custom" }, kinds)).toBeNull();
19 expect(examWeight({}, undefined)).toBeNull();
20});