Commit e502927
chore(test): improve test infrastructure, coverage, and quality (#65)
* feat(test-utils): add setupCommandTest helper to reduce command test boilerplate
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(test-utils): add itOutputsJson helper for common --json flag tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(test-utils): add parseCommand helper to simplify command invocation in tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(test-utils): replace vi.mock in setupCommandTest with mockGetClient factory
vi.mock() inside imported functions doesn't work reliably with Vitest hoisting.
Split into setupCommandTest (creates mockClient) + mockGetClient (vi.mock factory).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(test): migrate category/list, category/create, issue/delete tests to shared helpers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(test): migrate all list command tests to shared helpers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(test): migrate all create command tests to shared helpers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(test): migrate all delete command tests to shared helpers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(test): migrate all edit command tests to shared helpers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(test): migrate remaining command tests to shared helpers
Covers view, comment, count, auth, api, browse, dashboard tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(cli-utils): add edge case tests for outputResult
Covers null/undefined data, non-existent fields, and spaces in field names.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(cli): add handleError unit tests for error routing
Tests CommanderError, UserError, Backlog API error delegation, and fallthrough.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(issue): add @me resolution failure tests
Tests error propagation when getMyself fails with @me flag.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(cli-utils): add boundary value tests for split-arg and prompt
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(required-option): add edge case tests for resolveOptions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(issue): tighten payload validation for create and edit commands
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add strict payload validation to remaining create/edit commands
Add toEqual assertions to verify exact API payloads for milestone,
issue-type, status, document, and project create/edit commands.
This ensures no extra fields leak into API calls.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add error propagation tests to delete commands
Verify that API errors from delete operations are properly propagated
rather than silently swallowed, across all 7 delete command tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add API error propagation tests to create/edit commands
Ensure API errors from create and edit operations are properly
propagated across all 13 create/edit command tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add @me resolution failure and guard tests to PR commands
Add tests verifying that @me resolution errors propagate correctly
and that getMyself is not called when @me is not used.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add strict query parameter validation to list commands
Replace loose objectContaining checks with exact toEqual assertions
for default query parameters across all 4 list command tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add null safety for optional fields in issue and PR list display
Use optional chaining with fallback for status, issueType, and priority
fields that may be null in API responses.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add repeatable options, null edge cases, and flag behavior tests
- Verify multiple values for array options (--assignee, --status, etc.)
- Test graceful handling of null fields in API responses
- Verify boolean flag defaults and conditional branching logic
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs(AGENTS): add test policy for what to test vs. what not to test
Add clig.dev-aligned guidelines distinguishing application logic tests
(custom resolution, display logic, payload construction) from library
behavior tests (option parsing, flag forwarding, natural error propagation).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: remove redundant tests that verify library behavior
Remove 42 tests that were testing framework/library responsibilities
rather than application logic:
- Option parsing/forwarding tests (Commander/citty's job)
- collect/collectNum array collection tests (library callbacks)
- Boolean flag parsing tests (framework feature)
- "propagates API error" tests where implementation has no try/catch
(tests JavaScript's natural async rejection, not application code)
This follows the new test policy documented in AGENTS.md, aligned
with CLI Guidelines (clig.dev).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add exact payload construction tests for remaining commands
Add strict toEqual assertions for API payload defaults in category/edit,
issue-type/create, status/create, wiki/create, and wiki/edit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add conditional display and null resilience tests across commands
Add tests for:
- Conditional display logic (archived Yes/No, read/unread indicators,
role labels, null issue fallbacks)
- Null/undefined resilience in view commands (createdUser, dates,
emoji, description, status/priority)
Covers milestone/list, notification/list, watching/list+view,
repo/list, document/view, team/view, dashboard, issue/view, pr/view.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add null resilience and display tests to remaining commands
Cover activities (null createdUser/project/content), attachments
(null createdUser), wiki/view (null users), pr/count (@me resolution),
user/view+me (null lastLoginTime), and document/tree (null name).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: remove low-value tests and add resolution ID fallback coverage
Remove 10 tests that violate AGENTS.md policy:
- 3 "converts string ID to number" (tests JavaScript Number())
- 4 "@me error propagation" (tests await without try/catch)
- 3 "does not call getMyself" (trivial conditional negative)
Add 2 tests for issue close resolution ID fallback:
- Numeric resolution ID passthrough (covers ?? Number() branch)
- Unknown resolution name produces NaN (documents potential bug)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(test-utils): align vitest peer dependency and fix type compatibility
Bump vitest peerDependency from ^3.0.0 to ^4.0.0 to match root, and
use permissive types for parseCommand/itOutputsJson to avoid Commander
ParseOptions type mismatch across all 26 test files.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(test): resolve lint warnings for prefer-destructuring, group-exports, and consistent-type-imports
Use nested array destructuring for mock.calls access, consolidate
exports in stdout.ts, and remove typeof import() type annotations
in error.test.ts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 3d9e032 commit e502927
92 files changed
Lines changed: 2421 additions & 2011 deletions
File tree
- apps/cli/src
- commands
- auth
- category
- document
- issue-type
- issue
- milestone
- notification
- project
- pr
- repo
- space
- star
- status
- team
- user
- watching
- wiki
- lib
- packages
- cli-utils/src
- test-utils
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
355 | 379 | | |
356 | 380 | | |
357 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
5 | 10 | | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 15 | + | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | | - | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| |||
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | | - | |
60 | | - | |
| 58 | + | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
| |||
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
71 | | - | |
72 | | - | |
| 69 | + | |
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
| |||
81 | 78 | | |
82 | 79 | | |
83 | 80 | | |
84 | | - | |
85 | | - | |
| 81 | + | |
86 | 82 | | |
87 | 83 | | |
88 | 84 | | |
| |||
98 | 94 | | |
99 | 95 | | |
100 | 96 | | |
101 | | - | |
102 | | - | |
| 97 | + | |
103 | 98 | | |
104 | 99 | | |
105 | 100 | | |
| |||
114 | 109 | | |
115 | 110 | | |
116 | 111 | | |
117 | | - | |
118 | | - | |
| 112 | + | |
119 | 113 | | |
120 | 114 | | |
121 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
86 | 85 | | |
87 | 86 | | |
88 | 87 | | |
| |||
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | | - | |
104 | | - | |
| 102 | + | |
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
| |||
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
113 | | - | |
114 | | - | |
| 111 | + | |
115 | 112 | | |
116 | 113 | | |
117 | 114 | | |
| |||
148 | 145 | | |
149 | 146 | | |
150 | 147 | | |
151 | | - | |
152 | | - | |
| 148 | + | |
| 149 | + | |
153 | 150 | | |
154 | | - | |
155 | 151 | | |
156 | 152 | | |
157 | 153 | | |
| |||
208 | 204 | | |
209 | 205 | | |
210 | 206 | | |
211 | | - | |
212 | 207 | | |
213 | | - | |
| 208 | + | |
| 209 | + | |
214 | 210 | | |
215 | 211 | | |
216 | 212 | | |
| |||
219 | 215 | | |
220 | 216 | | |
221 | 217 | | |
222 | | - | |
223 | 218 | | |
224 | 219 | | |
225 | 220 | | |
| |||
233 | 228 | | |
234 | 229 | | |
235 | 230 | | |
236 | | - | |
237 | 231 | | |
238 | | - | |
| 232 | + | |
| 233 | + | |
239 | 234 | | |
240 | 235 | | |
241 | 236 | | |
| |||
244 | 239 | | |
245 | 240 | | |
246 | 241 | | |
247 | | - | |
248 | 242 | | |
249 | 243 | | |
250 | 244 | | |
| |||
257 | 251 | | |
258 | 252 | | |
259 | 253 | | |
260 | | - | |
261 | 254 | | |
262 | | - | |
| 255 | + | |
| 256 | + | |
263 | 257 | | |
264 | 258 | | |
265 | 259 | | |
| |||
268 | 262 | | |
269 | 263 | | |
270 | 264 | | |
271 | | - | |
272 | 265 | | |
273 | 266 | | |
274 | 267 | | |
| |||
298 | 291 | | |
299 | 292 | | |
300 | 293 | | |
301 | | - | |
302 | | - | |
| 294 | + | |
| 295 | + | |
303 | 296 | | |
304 | | - | |
305 | 297 | | |
306 | 298 | | |
307 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | | - | |
57 | 55 | | |
58 | | - | |
| 56 | + | |
59 | 57 | | |
60 | 58 | | |
61 | 59 | | |
| |||
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
75 | | - | |
76 | | - | |
| 73 | + | |
77 | 74 | | |
78 | 75 | | |
79 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| |||
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
69 | | - | |
| 67 | + | |
70 | 68 | | |
71 | 69 | | |
72 | 70 | | |
| |||
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
93 | | - | |
94 | | - | |
| 91 | + | |
95 | 92 | | |
96 | 93 | | |
97 | 94 | | |
| |||
128 | 125 | | |
129 | 126 | | |
130 | 127 | | |
131 | | - | |
132 | | - | |
| 128 | + | |
133 | 129 | | |
134 | 130 | | |
135 | 131 | | |
| |||
153 | 149 | | |
154 | 150 | | |
155 | 151 | | |
156 | | - | |
157 | | - | |
| 152 | + | |
158 | 153 | | |
159 | 154 | | |
160 | 155 | | |
| |||
0 commit comments