CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
pr-size.test.ts
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 74d8c4d | 1 | /** |
| 2 | * Tests for src/lib/pr-size.ts — computeSizeLabel and size constants. | |
| 3 | */ | |
| 4 | ||
| 5 | import { describe, test, expect } from "bun:test"; | |
| 6 | import { computeSizeLabel, type PrSizeLabel } from "../lib/pr-size"; | |
| 7 | ||
| 8 | describe("computeSizeLabel", () => { | |
| 9 | const cases: Array<[number, PrSizeLabel]> = [ | |
| 10 | [0, "XS"], | |
| 11 | [9, "XS"], | |
| 12 | [10, "S"], | |
| 13 | [49, "S"], | |
| 14 | [50, "M"], | |
| 15 | [199, "M"], | |
| 16 | [200, "L"], | |
| 17 | [499, "L"], | |
| 18 | [500, "XL"], | |
| 19 | [9999, "XL"], | |
| 20 | ]; | |
| 21 | ||
| 22 | for (const [lines, expected] of cases) { | |
| 23 | test(`${lines} lines → ${expected}`, () => { | |
| 24 | expect(computeSizeLabel(lines)).toBe(expected); | |
| 25 | }); | |
| 26 | } | |
| 27 | }); | |
| 28 | ||
| 29 | describe("size label boundaries", () => { | |
| 30 | test("XS threshold is < 10", () => { | |
| 31 | expect(computeSizeLabel(9)).toBe("XS"); | |
| 32 | expect(computeSizeLabel(10)).toBe("S"); | |
| 33 | }); | |
| 34 | test("S threshold is < 50", () => { | |
| 35 | expect(computeSizeLabel(49)).toBe("S"); | |
| 36 | expect(computeSizeLabel(50)).toBe("M"); | |
| 37 | }); | |
| 38 | test("M threshold is < 200", () => { | |
| 39 | expect(computeSizeLabel(199)).toBe("M"); | |
| 40 | expect(computeSizeLabel(200)).toBe("L"); | |
| 41 | }); | |
| 42 | test("L threshold is < 500", () => { | |
| 43 | expect(computeSizeLabel(499)).toBe("L"); | |
| 44 | expect(computeSizeLabel(500)).toBe("XL"); | |
| 45 | }); | |
| 46 | }); |