Skip to content

Commit 8e66bab

Browse files
committed
chore(tests): remove redundant and low-value tests
Remove ~500 lines of test bloat: Deleted files (fully redundant or zero-value): - test/lib/utils.test.ts: tested trivial one-liner regex wrapper - test/lib/seer-trial.property.test.ts: fake property tests using constantFrom over 3 fixed values; always returns false in test env - test/lib/errors.property.test.ts: fully redundant with existing withAuthGuard tests in errors.test.ts - test/lib/logger.property.test.ts: fully redundant with existing parseLogLevel/setLogLevel tests in logger.test.ts - test/lib/db/schema-migration-v8.test.ts: snapshot-in-time migration test that will break on schema v9; already covered by schema.test.ts Trimmed files: - test/lib/list-command.test.ts: removed 5 describe blocks testing Stricli constant shapes (kind, default, optional) that TypeScript already validates at compile time - test/lib/hex-id.test.ts: removed HEX_ID_RE and UUID_DASH_RE unit tests that are subsumed by property tests in the same file - test/lib/platforms.test.ts: removed fragile VALID_PLATFORMS.length count assertion that breaks on every platform addition
1 parent 101c05f commit 8e66bab

File tree

9 files changed

+53
-549
lines changed

9 files changed

+53
-549
lines changed

AGENTS.md

Lines changed: 46 additions & 35 deletions
Large diffs are not rendered by default.

test/lib/db/schema-migration-v8.test.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

test/lib/errors.property.test.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

test/lib/hex-id.test.ts

Lines changed: 6 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
*
44
* Property-based and unit tests for the shared hex ID validation
55
* in src/lib/hex-id.ts.
6+
*
7+
* Regex patterns (HEX_ID_RE, UUID_DASH_RE) are covered by the property tests
8+
* at the bottom of this file which generate random valid/invalid hex strings.
9+
* The unit tests here focus on `validateHexId` behavior: error messages,
10+
* whitespace handling, UUID normalization, and edge cases.
611
*/
712

813
import { describe, expect, test } from "bun:test";
914
import { array, constantFrom, assert as fcAssert, property } from "fast-check";
1015
import { ValidationError } from "../../src/lib/errors.js";
11-
import {
12-
HEX_ID_RE,
13-
UUID_DASH_RE,
14-
validateHexId,
15-
} from "../../src/lib/hex-id.js";
16+
import { validateHexId } from "../../src/lib/hex-id.js";
1617
import { DEFAULT_NUM_RUNS } from "../model-based/helpers.js";
1718

1819
const HEX_CHARS = "0123456789abcdefABCDEF".split("");
@@ -24,97 +25,6 @@ const validIdArb = array(constantFrom(...HEX_CHARS), {
2425
maxLength: 32,
2526
}).map((chars) => chars.join(""));
2627

27-
describe("HEX_ID_RE", () => {
28-
test("matches a valid 32-char lowercase hex string", () => {
29-
expect(HEX_ID_RE.test("aaaa1111bbbb2222cccc3333dddd4444")).toBe(true);
30-
});
31-
32-
test("matches a valid 32-char uppercase hex string", () => {
33-
expect(HEX_ID_RE.test("AAAA1111BBBB2222CCCC3333DDDD4444")).toBe(true);
34-
});
35-
36-
test("matches mixed-case hex", () => {
37-
expect(HEX_ID_RE.test("AaAa1111BbBb2222CcCc3333DdDd4444")).toBe(true);
38-
});
39-
40-
test("rejects shorter strings", () => {
41-
expect(HEX_ID_RE.test("abc123")).toBe(false);
42-
});
43-
44-
test("rejects longer strings", () => {
45-
expect(HEX_ID_RE.test(`${VALID_ID}extra`)).toBe(false);
46-
});
47-
48-
test("rejects non-hex characters", () => {
49-
expect(HEX_ID_RE.test("gggg1111bbbb2222cccc3333dddd4444")).toBe(false);
50-
});
51-
52-
test("rejects empty string", () => {
53-
expect(HEX_ID_RE.test("")).toBe(false);
54-
});
55-
56-
test("rejects strings with whitespace", () => {
57-
expect(HEX_ID_RE.test(" aaaa1111bbbb2222cccc3333dddd4444")).toBe(false);
58-
expect(HEX_ID_RE.test("aaaa1111bbbb2222cccc3333dddd4444 ")).toBe(false);
59-
});
60-
61-
test("rejects strings with newlines", () => {
62-
expect(HEX_ID_RE.test("aaaa1111bbbb2222cccc3333dddd4444\n")).toBe(false);
63-
});
64-
});
65-
66-
describe("UUID_DASH_RE", () => {
67-
test("matches a valid UUID with dashes (lowercase)", () => {
68-
expect(UUID_DASH_RE.test("aaaa1111-bbbb-2222-cccc-3333dddd4444")).toBe(
69-
true
70-
);
71-
});
72-
73-
test("matches a valid UUID with dashes (uppercase)", () => {
74-
expect(UUID_DASH_RE.test("AAAA1111-BBBB-2222-CCCC-3333DDDD4444")).toBe(
75-
true
76-
);
77-
});
78-
79-
test("matches mixed-case UUID", () => {
80-
expect(UUID_DASH_RE.test("AaAa1111-BbBb-2222-CcCc-3333DdDd4444")).toBe(
81-
true
82-
);
83-
});
84-
85-
test("rejects plain 32-char hex (no dashes)", () => {
86-
expect(UUID_DASH_RE.test("aaaa1111bbbb2222cccc3333dddd4444")).toBe(false);
87-
});
88-
89-
test("rejects dashes in wrong positions", () => {
90-
expect(UUID_DASH_RE.test("aaaa-1111bbbb-2222cccc-3333dddd-444444444")).toBe(
91-
false
92-
);
93-
});
94-
95-
test("rejects too few hex chars between dashes", () => {
96-
expect(UUID_DASH_RE.test("aaa-1111-bbbb-2222-cccc3333dddd4444")).toBe(
97-
false
98-
);
99-
});
100-
101-
test("rejects empty string", () => {
102-
expect(UUID_DASH_RE.test("")).toBe(false);
103-
});
104-
105-
test("rejects non-hex chars in UUID format", () => {
106-
expect(UUID_DASH_RE.test("gggg1111-bbbb-2222-cccc-3333dddd4444")).toBe(
107-
false
108-
);
109-
});
110-
111-
test("matches real user input from CLI-7Z", () => {
112-
expect(UUID_DASH_RE.test("ed29abc8-71c4-475b-9675-4655ef1a02d0")).toBe(
113-
true
114-
);
115-
});
116-
});
117-
11828
describe("validateHexId", () => {
11929
test("returns the ID for valid input", () => {
12030
expect(validateHexId(VALID_ID, "test ID")).toBe(VALID_ID);

test/lib/list-command.test.ts

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,20 @@
11
/**
22
* Tests for the shared list-command building blocks.
33
*
4-
* Verifies that the shared flag/parameter constants have the correct shape
5-
* and that `buildOrgListCommand` produces a working command that delegates
4+
* Tests `parseCursorFlag` validation and `buildOrgListCommand` delegation
65
* to `dispatchOrgScopedList`.
76
*/
87

98
import { afterEach, describe, expect, mock, spyOn, test } from "bun:test";
109
import {
11-
buildListLimitFlag,
1210
buildOrgListCommand,
13-
LIST_BASE_ALIASES,
14-
LIST_CURSOR_FLAG,
15-
LIST_JSON_FLAG,
16-
LIST_TARGET_POSITIONAL,
1711
type OrgListCommandDocs,
1812
parseCursorFlag,
1913
} from "../../src/lib/list-command.js";
2014
import type { OrgListConfig } from "../../src/lib/org-list.js";
2115
// biome-ignore lint/performance/noNamespaceImport: needed for spyOn mocking
2216
import * as orgListModule from "../../src/lib/org-list.js";
2317

24-
// ---------------------------------------------------------------------------
25-
// Shared constants: shape / value assertions
26-
// ---------------------------------------------------------------------------
27-
28-
describe("LIST_TARGET_POSITIONAL", () => {
29-
test("is a tuple with one optional string parameter", () => {
30-
expect(LIST_TARGET_POSITIONAL.kind).toBe("tuple");
31-
expect(LIST_TARGET_POSITIONAL.parameters).toHaveLength(1);
32-
const param = LIST_TARGET_POSITIONAL.parameters[0];
33-
expect(param.placeholder).toBe("org/project");
34-
expect(param.optional).toBe(true);
35-
expect(param.parse).toBe(String);
36-
});
37-
});
38-
39-
describe("LIST_JSON_FLAG", () => {
40-
test("is a boolean flag defaulting to false", () => {
41-
expect(LIST_JSON_FLAG.kind).toBe("boolean");
42-
expect(LIST_JSON_FLAG.default).toBe(false);
43-
});
44-
});
45-
46-
describe("LIST_CURSOR_FLAG", () => {
47-
test("is an optional parsed flag with cursor validation", () => {
48-
expect(LIST_CURSOR_FLAG.kind).toBe("parsed");
49-
expect(LIST_CURSOR_FLAG.optional).toBe(true);
50-
expect(LIST_CURSOR_FLAG.parse("last")).toBe("last");
51-
expect(LIST_CURSOR_FLAG.parse("1735689600:0:0")).toBe("1735689600:0:0");
52-
expect(() => LIST_CURSOR_FLAG.parse("12345")).toThrow("not a valid cursor");
53-
expect(LIST_CURSOR_FLAG.brief).toContain('"last"');
54-
});
55-
});
56-
57-
describe("buildListLimitFlag", () => {
58-
test("uses provided entity plural in brief", () => {
59-
const flag = buildListLimitFlag("widgets");
60-
expect(flag.brief).toContain("widgets");
61-
expect(flag.kind).toBe("parsed");
62-
});
63-
64-
test("defaults to '30' when no default provided", () => {
65-
const flag = buildListLimitFlag("teams");
66-
expect(flag.default).toBe("30");
67-
});
68-
69-
test("uses provided default value", () => {
70-
const flag = buildListLimitFlag("issues", "10");
71-
expect(flag.default).toBe("10");
72-
});
73-
});
74-
75-
describe("LIST_BASE_ALIASES", () => {
76-
test("maps n to limit and c to cursor", () => {
77-
expect(LIST_BASE_ALIASES.n).toBe("limit");
78-
expect(LIST_BASE_ALIASES.c).toBe("cursor");
79-
});
80-
81-
test("can be spread with additional aliases", () => {
82-
const extended = { ...LIST_BASE_ALIASES, p: "platform" };
83-
expect(extended.n).toBe("limit");
84-
expect(extended.c).toBe("cursor");
85-
expect(extended.p).toBe("platform");
86-
});
87-
});
88-
89-
// ---------------------------------------------------------------------------
90-
// parseCursorFlag: shared cursor validation
91-
// ---------------------------------------------------------------------------
92-
9318
describe("parseCursorFlag", () => {
9419
test("passes through 'last' keyword", () => {
9520
expect(parseCursorFlag("last")).toBe("last");

0 commit comments

Comments
 (0)