mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-05-19 07:43:09 +00:00
Reject invalid --format and --period values instead of silently falling back (#258)
getDateRange() silently fell back to week on unknown periods, and no command validated --format. A typo like --period mounth or --format yaml produced wrong output with exit 0. Now all 6 format-accepting commands and all period-accepting paths reject unknown values with a clear message and exit 1. Also fixes the status description (said today+week+month, only shows today+month).
This commit is contained in:
parent
daa673449c
commit
fb8f25fb97
3 changed files with 22 additions and 7 deletions
|
|
@ -81,10 +81,8 @@ describe('getDateRange', () => {
|
|||
expect(range.end.getHours()).toBe(23)
|
||||
})
|
||||
|
||||
it('unknown period falls back to "week"', () => {
|
||||
const fallback = getDateRange('not-a-period')
|
||||
const week = getDateRange('week')
|
||||
expect(fallback.label).toBe(week.label)
|
||||
it('unknown period exits with an error instead of silently falling back', () => {
|
||||
expect(() => getDateRange('not-a-period')).toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue