Skip to content

Commit ebcafab

Browse files
committed
test(argv-flags): consolidate 14 flag smoke tests via it.each
Also raise docs/ max file count from 10 to 11 to cover auto-generated api-index.md.
1 parent cd52fef commit ebcafab

File tree

2 files changed

+26
-80
lines changed

2 files changed

+26
-80
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
## DOCUMENTATION POLICY
8181

82-
**Allowed**: `README.md`, `CLAUDE.md`, `SECURITY.md`, `CHANGELOG.md`, `docs/` (max 10 files), `.claude/` (functional only), `*/README.md` for complex subsystems only.
82+
**Allowed**: `README.md`, `CLAUDE.md`, `SECURITY.md`, `CHANGELOG.md`, `docs/` (max 11 files), `.claude/` (functional only), `*/README.md` for complex subsystems only.
8383

8484
**Forbidden**: Migration/planning docs after completion, redundant guides, docs duplicating code comments, tutorial content, ADRs unless requested. After migrations or major refactors, DELETE planning documents.
8585

test/unit/argv-flags.test.mts

Lines changed: 25 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -331,85 +331,31 @@ describe('argv/flags', () => {
331331
expect(typeof COMMON_FLAGS).toBe('object')
332332
})
333333

334-
it('should have all flag defined', () => {
335-
expect(COMMON_FLAGS.all).toBeDefined()
336-
expect(COMMON_FLAGS.all.type).toBe('boolean')
337-
expect(COMMON_FLAGS.all.default).toBe(false)
338-
})
339-
340-
it('should have changed flag defined', () => {
341-
expect(COMMON_FLAGS.changed).toBeDefined()
342-
expect(COMMON_FLAGS.changed.type).toBe('boolean')
343-
})
344-
345-
it('should have coverage flag defined', () => {
346-
expect(COMMON_FLAGS.coverage).toBeDefined()
347-
expect(COMMON_FLAGS.coverage.type).toBe('boolean')
348-
})
349-
350-
it('should have debug flag defined', () => {
351-
expect(COMMON_FLAGS.debug).toBeDefined()
352-
expect(COMMON_FLAGS.debug.type).toBe('boolean')
353-
})
354-
355-
it('should have dry-run flag defined', () => {
356-
expect(COMMON_FLAGS['dry-run']).toBeDefined()
357-
expect(COMMON_FLAGS['dry-run'].type).toBe('boolean')
358-
})
359-
360-
it('should have fix flag defined', () => {
361-
expect(COMMON_FLAGS.fix).toBeDefined()
362-
expect(COMMON_FLAGS.fix.type).toBe('boolean')
363-
})
364-
365-
it('should have force flag defined', () => {
366-
expect(COMMON_FLAGS.force).toBeDefined()
367-
expect(COMMON_FLAGS.force.type).toBe('boolean')
368-
})
369-
370-
it('should have help flag with short alias', () => {
371-
expect(COMMON_FLAGS.help).toBeDefined()
372-
expect(COMMON_FLAGS.help.type).toBe('boolean')
373-
expect(COMMON_FLAGS.help.short).toBe('h')
374-
})
375-
376-
it('should have json flag defined', () => {
377-
expect(COMMON_FLAGS.json).toBeDefined()
378-
expect(COMMON_FLAGS.json.type).toBe('boolean')
379-
})
380-
381-
it('should have quiet flag with short alias', () => {
382-
expect(COMMON_FLAGS.quiet).toBeDefined()
383-
expect(COMMON_FLAGS.quiet.type).toBe('boolean')
384-
expect(COMMON_FLAGS.quiet.short).toBe('q')
385-
})
386-
387-
it('should have silent flag defined', () => {
388-
expect(COMMON_FLAGS.silent).toBeDefined()
389-
expect(COMMON_FLAGS.silent.type).toBe('boolean')
390-
})
391-
392-
it('should have staged flag defined', () => {
393-
expect(COMMON_FLAGS.staged).toBeDefined()
394-
expect(COMMON_FLAGS.staged.type).toBe('boolean')
395-
})
396-
397-
it('should have update flag with short alias', () => {
398-
expect(COMMON_FLAGS.update).toBeDefined()
399-
expect(COMMON_FLAGS.update.type).toBe('boolean')
400-
expect(COMMON_FLAGS.update.short).toBe('u')
401-
})
402-
403-
it('should have verbose flag with short alias', () => {
404-
expect(COMMON_FLAGS.verbose).toBeDefined()
405-
expect(COMMON_FLAGS.verbose.type).toBe('boolean')
406-
expect(COMMON_FLAGS.verbose.short).toBe('v')
407-
})
408-
409-
it('should have watch flag with short alias', () => {
410-
expect(COMMON_FLAGS.watch).toBeDefined()
411-
expect(COMMON_FLAGS.watch.type).toBe('boolean')
412-
expect(COMMON_FLAGS.watch.short).toBe('w')
334+
it.each([
335+
{ name: 'all', extra: { default: false } },
336+
{ name: 'changed' },
337+
{ name: 'coverage' },
338+
{ name: 'debug' },
339+
{ name: 'dry-run' },
340+
{ name: 'fix' },
341+
{ name: 'force' },
342+
{ name: 'help', extra: { short: 'h' } },
343+
{ name: 'json' },
344+
{ name: 'quiet', extra: { short: 'q' } },
345+
{ name: 'silent' },
346+
{ name: 'staged' },
347+
{ name: 'update', extra: { short: 'u' } },
348+
{ name: 'verbose', extra: { short: 'v' } },
349+
{ name: 'watch', extra: { short: 'w' } },
350+
])('should define $name as boolean flag', ({ name, extra }) => {
351+
const flag = COMMON_FLAGS[name as keyof typeof COMMON_FLAGS]
352+
expect(flag).toBeDefined()
353+
expect(flag.type).toBe('boolean')
354+
if (extra) {
355+
for (const [key, value] of Object.entries(extra)) {
356+
expect(flag[key as keyof typeof flag]).toBe(value)
357+
}
358+
}
413359
})
414360

415361
it('should have descriptions for all flags', () => {

0 commit comments

Comments
 (0)