fix: reset-to-auto in both rip branches, visible mutation failures, distinct invalid-token error
This commit is contained in:
@@ -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())
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user