hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { describe, expect, it } from "vitest"; |
| 2 | import { skipReasonCopy } from "./blueprint-skip"; |
| 3 | |
| 4 | describe("skipReasonCopy", () => { |
| 5 | it("maps the fixed reasons", () => { |
| 6 | expect(skipReasonCopy("the class is already at its course ceiling", "Algebra").key).toBe( |
| 7 | "classBlueprints.skipCeiling", |
| 8 | ); |
| 9 | expect( |
| 10 | skipReasonCopy("The class was deleted while the blueprint was being applied.", "Algebra").key, |
| 11 | ).toBe("classBlueprints.skipClassGone"); |
| 12 | }); |
| 13 | |
| 14 | it("survives the punctuation and casing normalization", () => { |
| 15 | expect(skipReasonCopy(" THE CLASS IS ALREADY AT ITS COURSE CEILING! ", "x").key).toBe( |
| 16 | "classBlueprints.skipCeiling", |
| 17 | ); |
| 18 | }); |
| 19 | |
| 20 | it("re-parameterizes the course-named reasons with the resolved title", () => { |
| 21 | const seat = skipReasonCopy("Algebra II has no free seat for the whole class", "Cebir II"); |
| 22 | expect(seat.key).toBe("classBlueprints.skipNoSeat"); |
| 23 | expect(seat.vars).toEqual({ course: "Cebir II" }); |
| 24 | |
| 25 | const gone = skipReasonCopy("Algebra II no longer exists — detach it from this class first", "Cebir II"); |
| 26 | expect(gone.key).toBe("classBlueprints.skipCourseGone"); |
| 27 | expect(gone.vars).toEqual({ course: "Cebir II" }); |
| 28 | }); |
| 29 | |
| 30 | it("falls back to the generic line rather than leaking unmapped English", () => { |
| 31 | expect(skipReasonCopy("something the backend added later", "x").key).toBe("classBlueprints.skipOther"); |
| 32 | }); |
| 33 | }); |