We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bca6374 commit 969c572Copy full SHA for 969c572
1 file changed
src/tests/useQuery.test.js
@@ -138,4 +138,23 @@ describe('useQuery', () => {
138
139
expect(queryFn).toHaveBeenCalledWith('test', variables)
140
})
141
+
142
+ // See https://github.com/tannerlinsley/react-query/issues/161
143
+ it('should not fetch query when `manual` is set to `true`', async () => {
144
+ const queryFn = jest.fn()
145
146
+ function Page() {
147
+ const { data = 'default' } = useQuery('test', queryFn, { manual: true })
148
149
+ return (
150
+ <div>
151
+ <h1>{data}</h1>
152
+ </div>
153
+ )
154
+ }
155
156
+ const rendered = render(<Page />)
157
+ await waitForElement(() => rendered.getByText('default'))
158
+ expect(queryFn).not.toHaveBeenCalled()
159
+ })
160
0 commit comments