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-labels.test.ts14 lines, 470 bytesHistoryRawDownload
1import { expect, test } from "vitest";
2import { attemptLabel } from "./exam-labels";
3
4test("shows used/max when the exam caps attempts", () => {
5 expect(attemptLabel({ attempts_used: 1, attempt: 1 }, 3)).toBe("1 / 3");
6});
7
8test("unlimited attempts (max 0) falls back to the attempt count", () => {
9 expect(attemptLabel({ attempts_used: 2, attempt: 2 }, 0)).toBe("2");
10});
11
12test("no attempt data renders a dash", () => {
13 expect(attemptLabel({}, 3)).toBe("—");
14});