1
0

fix: reset-to-auto in both rip branches, visible mutation failures, distinct invalid-token error

This commit is contained in:
2026-09-03 19:24:57 +02:00
parent f2fff1d7be
commit 21a4c69972
6 changed files with 101 additions and 24 deletions

View File

@@ -127,4 +127,19 @@ describe('ItemPage', () => {
const linkBtn = await screen.findByRole('button', { name: /^link$/i })
expect(linkBtn).toHaveProperty('disabled', true)
})
it('shows Reset to auto for a manual not-ripped override', async () => {
vi.mocked(api.getItem).mockResolvedValue({ ...item, ripOverride: false, ripStatus: 'not_ripped' } as never)
renderItem()
await waitFor(() => expect(screen.getByText(/not ripped yet \(manually set\)/i)).toBeTruthy())
expect(screen.getByRole('button', { name: /reset to auto/i })).toBeTruthy()
expect(screen.getByRole('button', { name: /mark ripped/i })).toBeTruthy()
})
it('shows an error when a rip toggle fails', async () => {
vi.mocked(api.setRip).mockRejectedValue(new TypeError('fetch failed'))
renderItem()
await userEvent.click(await screen.findByRole('button', { name: /mark ripped/i }))
await waitFor(() => expect(screen.getByText(/didn't work/i)).toBeTruthy())
})
})