Skip to content

Commit 9ba9a4a

Browse files
committed
Update tests
1 parent 5ee01b3 commit 9ba9a4a

File tree

3 files changed

+1057
-92
lines changed

3 files changed

+1057
-92
lines changed

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
"react": "^16.6.3"
2323
},
2424
"dependencies": {
25-
"@types/react-query": "^0.3.0"
25+
"@types/react-query": "^0.3.7"
2626
},
2727
"devDependencies": {
28-
"@babel/core": "^7.7.4",
29-
"@babel/preset-env": "^7.4.5",
30-
"@babel/preset-react": "^7.0.0",
28+
"@babel/core": "^7.8.4",
29+
"@babel/preset-env": "^7.8.4",
30+
"@babel/preset-react": "^7.8.3",
3131
"@svgr/rollup": "^4.3.0",
3232
"@testing-library/react": "^9.4.0",
3333
"babel-core": "7.0.0-bridge.0",
@@ -44,23 +44,23 @@
4444
"eslint-plugin-import": "2.x",
4545
"eslint-plugin-jsx-a11y": "6.x",
4646
"eslint-plugin-node": "^9.1.0",
47-
"eslint-plugin-prettier": "^3.1.0",
47+
"eslint-plugin-prettier": "^3.1.2",
4848
"eslint-plugin-promise": "^4.1.1",
49-
"eslint-plugin-react": "7.x",
49+
"eslint-plugin-react": "7.18.3",
5050
"eslint-plugin-react-hooks": "1.5.0",
5151
"eslint-plugin-standard": "^4.0.0",
5252
"jest": "^24.9.0",
53-
"prettier": "^1.18.2",
54-
"react": "^16.8.6",
55-
"react-dom": "^16.8.6",
56-
"rollup": "^1.12.4",
53+
"prettier": "^1.19.1",
54+
"react": "^16.12.0",
55+
"react-dom": "^16.12.0",
56+
"rollup": "^1.31.1",
5757
"rollup-plugin-babel": "^4.3.2",
5858
"rollup-plugin-commonjs": "^10.0.0",
5959
"rollup-plugin-node-resolve": "^5.0.0",
60-
"rollup-plugin-peer-deps-external": "^2.2.0",
61-
"rollup-plugin-size": "^0.2.1",
60+
"rollup-plugin-peer-deps-external": "^2.2.2",
61+
"rollup-plugin-size": "^0.2.2",
6262
"rollup-plugin-size-snapshot": "^0.10.0",
63-
"rollup-plugin-terser": "^5.1.2"
63+
"rollup-plugin-terser": "^5.2.0"
6464
},
6565
"files": [
6666
"dist"

src/__tests__/useMutation-test.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
cleanup,
33
render,
44
fireEvent,
5+
waitForElement,
56
} from '@testing-library/react'
67
import * as React from 'react'
78
import { act } from 'react-dom/test-utils'
@@ -13,7 +14,9 @@ describe('useMutation', () => {
1314

1415
it('should be able to reset `data`', async () => {
1516
function Page() {
16-
const [mutate, mutationResult] = useMutation(() => Promise.resolve('mutation'))
17+
const [mutate, mutationResult] = useMutation(() =>
18+
Promise.resolve('mutation')
19+
)
1720

1821
return (
1922
<div>
@@ -28,15 +31,15 @@ describe('useMutation', () => {
2831

2932
expect(getByTestId('title').textContent).toBe('')
3033

31-
await act(async () => {
32-
fireEvent.click(getByText('mutate'))
33-
})
34+
fireEvent.click(getByText('mutate'))
35+
36+
await waitForElement(() => getByTestId('title'))
3437

3538
expect(getByTestId('title').textContent).toBe('mutation')
3639

37-
await act(async () => {
38-
fireEvent.click(getByText('reset'))
39-
})
40+
fireEvent.click(getByText('reset'))
41+
42+
await waitForElement(() => getByTestId('title'))
4043

4144
expect(getByTestId('title').textContent).toBe('')
4245
})

0 commit comments

Comments
 (0)