Skip to content

Commit 3f10705

Browse files
authored
test(query-devtools/Devtools): add test for rendering an idle mutation row (#10764)
1 parent d5c6df7 commit 3f10705

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/query-devtools/src/__tests__/Devtools.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,22 @@ describe('Devtools', () => {
339339
rendered.getByLabelText(/Mutation submitted at/),
340340
).toBeInTheDocument()
341341
})
342+
343+
it('should render an idle mutation that has been built but not executed', async () => {
344+
const rendered = renderDevtools({ initialIsOpen: true })
345+
346+
fireEvent.click(rendered.getByText('Mutations'))
347+
348+
queryClient.getMutationCache().build(queryClient, {
349+
mutationKey: ['idle-mut'],
350+
mutationFn: () => Promise.resolve('ok'),
351+
})
352+
await vi.advanceTimersByTimeAsync(0)
353+
354+
expect(
355+
rendered.getByLabelText(/Mutation submitted at/),
356+
).toBeInTheDocument()
357+
})
342358
})
343359

344360
describe('disabled and static queries', () => {

0 commit comments

Comments
 (0)