Skip to content

Commit 3719a6c

Browse files
committed
prettier
1 parent 1e7c606 commit 3719a6c

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

packages/react-query/src/__tests__/useSuspenseQuery.test.tsx

+23-11
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import type {
1717
UseSuspenseInfiniteQueryResult,
1818
UseSuspenseQueryResult,
1919
} from '..'
20-
import { createRenderStream, disableActEnvironment, cleanup } from '@testing-library/react-render-stream'
20+
import {
21+
createRenderStream,
22+
disableActEnvironment,
23+
cleanup,
24+
} from '@testing-library/react-render-stream'
2125

2226
// should probably end up in some setup file
2327
afterEach(cleanup)
@@ -31,7 +35,9 @@ describe('useSuspenseQuery', () => {
3135

3236
const key = queryKey()
3337

34-
const renderStream = createRenderStream<UseSuspenseQueryResult<number> | undefined>({ snapshotDOM: true })
38+
const renderStream = createRenderStream<
39+
UseSuspenseQueryResult<number> | undefined
40+
>({ snapshotDOM: true })
3541

3642
let count = 0
3743

@@ -62,37 +68,43 @@ describe('useSuspenseQuery', () => {
6268
<Page />
6369
</React.Suspense>,
6470
{
65-
wrapper: ({ children }) => <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
66-
}
71+
wrapper: ({ children }) => (
72+
<QueryClientProvider client={queryClient}>
73+
{children}
74+
</QueryClientProvider>
75+
),
76+
},
6777
)
6878

6979
{
7080
const { snapshot, withinDOM } = await renderStream.takeRender()
7181
// Page didn't render yet, so no call to `replaceSnapshot` yet
7282
expect(snapshot).toBeUndefined() // I'd probably skip this assertion
73-
withinDOM().getByText("loading")
83+
withinDOM().getByText('loading')
7484
}
7585
{
7686
const { snapshot, withinDOM } = await renderStream.takeRender()
7787
expect(snapshot).toMatchObject({ data: 1, status: 'success' })
78-
withinDOM().getByText("data: 1") // I'd probably skip this assertion
88+
withinDOM().getByText('data: 1') // I'd probably skip this assertion
7989
}
8090
fireEvent.click(rendered.getByLabelText('toggle'))
8191
{
8292
const { snapshot, withinDOM } = await renderStream.takeRender()
8393
// Page is suspended so it doesn't replace the snapshot yet
8494
expect(snapshot).toMatchObject({ data: 1, status: 'success' }) // I'd probably skip this assertion
85-
withinDOM().getByText("loading")
95+
withinDOM().getByText('loading')
8696
}
8797
{
8898
const { snapshot, withinDOM } = await renderStream.takeRender()
8999
expect(snapshot).toMatchObject({ data: 2, status: 'success' })
90-
withinDOM().getByText("data: 2") // I'd probably skip this assertion
100+
withinDOM().getByText('data: 2') // I'd probably skip this assertion
91101
}
92-
102+
93103
// this would require setup of this matcher, seems that automatically only works with jest
94104
// expect(renderStream).not.toRerender()
95-
await expect(renderStream.takeRender).rejects.toMatchObject({message: expect.stringMatching(/Exceeded timeout/)})
105+
await expect(renderStream.takeRender).rejects.toMatchObject({
106+
message: expect.stringMatching(/Exceeded timeout/),
107+
})
96108
})
97109

98110
it('should return the correct states for a successful infinite query', async () => {
@@ -900,7 +912,7 @@ describe('useSuspenseQuery', () => {
900912
it('should log an error when skipToken is passed as queryFn', () => {
901913
const consoleErrorSpy = vi
902914
.spyOn(console, 'error')
903-
.mockImplementation(() => { })
915+
.mockImplementation(() => {})
904916
const key = queryKey()
905917

906918
function Page() {

0 commit comments

Comments
 (0)