fix: resolve ui audit bugs
ci / docker (push) Successful in 3m30s

This commit is contained in:
2026-09-07 09:08:22 +08:00
parent 6f7694c23e
commit ec90e9155e
7 changed files with 119 additions and 16 deletions
+20
View File
@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest'
import { formatApiErrorDetail, nextTotalAfterLocalTaskAdd } from './mvp-utils'
describe('UI bugfix helpers', () => {
it('formats FastAPI validation arrays into readable messages', () => {
expect(formatApiErrorDetail([
{ loc: ['body', 'lunar_day'], msg: 'Input should be less than or equal to 30' },
{ loc: ['body', 'title'], msg: 'String should have at least 1 character' },
])).toBe('lunar_dayInput should be less than or equal to 30titleString should have at least 1 character')
})
it('formats nested API detail objects instead of [object Object]', () => {
expect(formatApiErrorDetail({ detail: [{ loc: ['body', 'event_date'], msg: 'Input should be a valid date' }] })).toBe('event_dateInput should be a valid date')
})
it('increments the visible total after a local quick-add insert', () => {
expect(nextTotalAfterLocalTaskAdd(0)).toBe(1)
expect(nextTotalAfterLocalTaskAdd(49)).toBe(50)
})
})