Skip to content

Commit 49872bb

Browse files
committed
test: address bot review findings in inbox triage action visibility tests
- Add `errorMessage?: string | null` to `detailById` Record type so the Failed-item test no longer assigns an excess property (Copilot CS7036 risk) - Replace brittle `toHaveLength(4)` button-count assertion with per-label presence checks for Refresh Detail / triage action / Ignore / Cancel - Simplify batchBusy test: drop the redundant unresolved-promise mock and triageBtn click; set `batchBusy = true` directly, then assert exactly 3 disabled buttons (Triage/Ignore/Cancel) and that Clear stays enabled
1 parent e43ee2e commit 49872bb

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

frontend/taskdeck-web/src/tests/views/InboxView.spec.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const mockCaptureStore = reactive({
4242
createdAt: string
4343
processedAt: string | null
4444
retryCount: number
45+
errorMessage?: string | null
4546
provenance?: {
4647
captureItemId: string
4748
triageRunId: string | null
@@ -1523,8 +1524,12 @@ describe('InboxView', () => {
15231524

15241525
const footer = wrapper.get('.td-inbox-detail__actions')
15251526
const footerButtons = footer.findAll('button')
1526-
// Refresh Detail, triage action, Ignore, Cancel
1527-
expect(footerButtons).toHaveLength(4)
1527+
const buttonTexts = footerButtons.map((b) => b.text())
1528+
// Verify all required footer actions are present: Refresh Detail, triage action, Ignore, Cancel
1529+
expect(buttonTexts.some((t) => t.includes('Refresh Detail') || t.includes('Refreshing'))).toBe(true)
1530+
expect(buttonTexts.some((t) => t.includes('Start Triage') || t.includes('Triage') || t.includes('Converted'))).toBe(true)
1531+
expect(buttonTexts.some((t) => t.includes('Ignore'))).toBe(true)
1532+
expect(buttonTexts.some((t) => t.includes('Cancel'))).toBe(true)
15281533
})
15291534
})
15301535

@@ -1619,28 +1624,21 @@ describe('InboxView', () => {
16191624
})
16201625

16211626
it('batch action buttons are disabled while batch operation is in progress', async () => {
1622-
mockCaptureStore.batchTriage.mockImplementation(
1623-
() => new Promise(() => {
1624-
// Intentionally unresolved to keep batchBusy active.
1625-
}),
1626-
)
1627-
16281627
const wrapper = mount(InboxView)
16291628
await waitForUi()
16301629

16311630
await wrapper.get('[data-testid="inbox-item-checkbox"]').trigger('click')
16321631
await waitForUi()
16331632

1634-
const bar = wrapper.get('[data-testid="batch-action-bar"]')
1635-
const triageBtn = bar.findAll('button').find((b) => b.text().includes('Triage'))
1636-
await triageBtn?.trigger('click')
1637-
await waitForUi()
1638-
16391633
mockCaptureStore.batchBusy = true
16401634
await waitForUi()
16411635

1642-
const batchButtons = wrapper.get('[data-testid="batch-action-bar"]').findAll('button[disabled]')
1643-
expect(batchButtons.length).toBeGreaterThan(0)
1636+
const bar = wrapper.get('[data-testid="batch-action-bar"]')
1637+
// Triage, Ignore, and Cancel are disabled when batchBusy; Clear remains enabled
1638+
const disabledButtons = bar.findAll('button[disabled]')
1639+
expect(disabledButtons).toHaveLength(3)
1640+
const clearBtn = bar.findAll('button').find((b) => b.text() === 'Clear')
1641+
expect(clearBtn!.attributes('disabled')).toBeUndefined()
16441642
})
16451643

16461644
it('empty inbox does not render select-all checkbox or batch bar', async () => {

0 commit comments

Comments
 (0)