feat(user-settings): voeg IdeasListPrefs schema toe met filterStatuses
Nieuw IdeasListPrefs-subschema met filterStatuses (array van IdeaStatusApi-waarden), ingehangen als views.ideasList in ViewsPrefs. Testdekking voor geldig, ongeldig en leeg filterStatuses. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3d5c22382c
commit
f8dd687c32
2 changed files with 19 additions and 0 deletions
|
|
@ -108,6 +108,7 @@ describe('UserSettingsSchema', () => {
|
|||
storyPanel: { sort: 'date' },
|
||||
jobsColumns: { 'queue:active': { kinds: ['TASK_IMPLEMENTATION'], statuses: [] } },
|
||||
jobs: { timeFilter: '24h' },
|
||||
ideasList: { filterStatuses: ['draft', 'planned'] },
|
||||
},
|
||||
devTools: { debugMode: true },
|
||||
layout: {
|
||||
|
|
@ -185,6 +186,16 @@ describe('UserSettingsSchema', () => {
|
|||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects an invalid ideasList.filterStatuses value', () => {
|
||||
const result = UserSettingsSchema.safeParse({ views: { ideasList: { filterStatuses: ['BOGUS'] } } })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('accepts an empty ideasList.filterStatuses array', () => {
|
||||
const result = UserSettingsSchema.safeParse({ views: { ideasList: { filterStatuses: [] } } })
|
||||
expect(result.success).toBe(true)
|
||||
})
|
||||
|
||||
it('rejects unknown intent value', () => {
|
||||
const result = UserSettingsSchema.safeParse({
|
||||
workflow: {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { z } from 'zod'
|
||||
import { JOBS_TIME_FILTER_VALUES } from '@/lib/jobs-time-filter'
|
||||
import { IDEA_STATUS_API_VALUES, type IdeaStatusApi } from '@/lib/idea-status'
|
||||
|
||||
const PriorityFilter = z.union([
|
||||
z.number().int().min(1).max(4),
|
||||
|
|
@ -37,12 +38,19 @@ const JobsViewPrefs = z.object({
|
|||
timeFilter: z.enum(JOBS_TIME_FILTER_VALUES).optional(),
|
||||
}).strict()
|
||||
|
||||
const IdeasListPrefs = z.object({
|
||||
filterStatuses: z.array(
|
||||
z.enum(IDEA_STATUS_API_VALUES as [IdeaStatusApi, ...IdeaStatusApi[]])
|
||||
).optional(),
|
||||
}).strict()
|
||||
|
||||
const ViewsPrefs = z.object({
|
||||
sprintBacklog: SprintBacklogPrefs.optional(),
|
||||
pbiList: PbiListPrefs.optional(),
|
||||
storyPanel: StoryPanelPrefs.optional(),
|
||||
jobsColumns: z.record(z.string(), JobsColumnPrefs).optional(),
|
||||
jobs: JobsViewPrefs.optional(),
|
||||
ideasList: IdeasListPrefs.optional(),
|
||||
}).strict()
|
||||
|
||||
const DevToolsPrefs = z.object({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue