Skip to content

Commit f492943

Browse files
authored
chore(deps): update deps (#168)
1 parent 67343f8 commit f492943

File tree

8 files changed

+1043
-696
lines changed

8 files changed

+1043
-696
lines changed

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,31 @@
3030
"author": "Vasil Dimitrov",
3131
"license": "MIT",
3232
"devDependencies": {
33-
"@babel/core": "7.14.8",
34-
"@babel/preset-env": "7.14.8",
33+
"@babel/core": "7.15.0",
34+
"@babel/preset-env": "7.15.0",
3535
"@babel/preset-react": "7.14.5",
3636
"babel-loader": "8.2.2",
3737
"codecov": "3.8.3",
3838
"eslint": "7.32.0",
3939
"eslint-config-prettier": "8.3.0",
4040
"eslint-config-standard": "16.0.3",
41-
"eslint-plugin-import": "2.23.4",
41+
"eslint-plugin-import": "2.24.2",
4242
"eslint-plugin-node": "11.1.0",
43-
"eslint-plugin-prettier": "3.4.0",
43+
"eslint-plugin-prettier": "3.4.1",
4444
"eslint-plugin-react": "7.24.0",
4545
"eslint-plugin-react-hooks": "4.2.0",
46-
"husky": "6.0.0",
47-
"jest": "26.6.3",
46+
"husky": "7.0.2",
47+
"jest": "27.1.0",
4848
"lerna": "4.0.0",
49-
"lint-staged": "11.1.1",
49+
"lint-staged": "11.1.2",
5050
"path": "0.12.7",
5151
"prettier": "2.3.2",
5252
"prop-types": "15.7.2",
5353
"react": "17.0.2",
5454
"react-dom": "17.0.2",
5555
"react-test-renderer": "17.0.2",
56-
"webpack": "5.47.1",
57-
"webpack-cli": "4.7.2"
56+
"webpack": "5.51.1",
57+
"webpack-cli": "4.8.0"
5858
},
5959
"lint-staged": {
6060
"*.{js,jsx}": "eslint --fix"

packages/mobile/__tests__/CountdownCircleTimer.test.js

Lines changed: 35 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { Text } from 'react-native'
33
import renderer from 'react-test-renderer'
4-
import { render, act } from '@testing-library/react-native'
4+
import { render, waitFor } from '@testing-library/react-native'
55

66
import { CountdownCircleTimer } from '../src'
77

@@ -84,7 +84,26 @@ describe('snapshot tests', () => {
8484
it('renders with different trail stroke width', () => {
8585
const tree = renderer
8686
.create(
87-
<CountdownCircleTimer {...fixture} trailStrokeWidth={16} strokeWidth={14}>
87+
<CountdownCircleTimer
88+
{...fixture}
89+
trailStrokeWidth={16}
90+
strokeWidth={14}
91+
>
92+
{({ remainingTime }) => <Text>{remainingTime}</Text>}
93+
</CountdownCircleTimer>
94+
)
95+
.toJSON()
96+
97+
expect(tree).toMatchSnapshot()
98+
})
99+
100+
it('renders correctly when color duration is not provided', () => {
101+
const tree = renderer
102+
.create(
103+
<CountdownCircleTimer
104+
{...fixture}
105+
colors={[['#047'], ['#aaa'], ['#bbb']]}
106+
>
88107
{({ remainingTime }) => <Text>{remainingTime}</Text>}
89108
</CountdownCircleTimer>
90109
)
@@ -104,76 +123,24 @@ describe('functional tests', () => {
104123

105124
expect(getByText('4')).toBeTruthy()
106125
})
107-
108-
it('should call onComplete at the end of the countdown', () => {
109-
global.withAnimatedTimeTravelEnabled(() => {
110-
const onComplete = jest.fn()
111-
const { getByText } = render(
112-
<CountdownCircleTimer {...fixture} isPlaying onComplete={onComplete}>
113-
{({ remainingTime }) => <Text>{remainingTime}</Text>}
114-
</CountdownCircleTimer>
115-
)
116-
117-
act(() => {
118-
global.timeTravel(10000)
119-
})
120-
121-
expect(getByText('0')).toBeTruthy()
122-
expect(onComplete).toHaveBeenCalledWith(10)
123-
})
124-
})
125126
})
126127

127128
describe('behaviour tests', () => {
128-
it('should call onComplete at the end of the countdown', () => {
129-
global.withAnimatedTimeTravelEnabled(() => {
130-
const onComplete = jest.fn()
131-
const { getByText } = render(
132-
<CountdownCircleTimer {...fixture} isPlaying onComplete={onComplete}>
133-
{({ remainingTime }) => <Text>{remainingTime}</Text>}
134-
</CountdownCircleTimer>
135-
)
136-
137-
act(() => {
138-
global.timeTravel(10000)
139-
})
140-
141-
expect(getByText('0')).toBeTruthy()
142-
expect(onComplete).toHaveBeenCalledWith(10)
143-
})
144-
})
145-
146-
it('should repeat the countdown when onComplete return an array with shouldRepeat = true', () => {
147-
global.withAnimatedTimeTravelEnabled(() => {
148-
const duration = 1
149-
const shouldRepeat = true
150-
const onComplete = jest.fn().mockReturnValueOnce([shouldRepeat])
151-
const component = (isPlaying) => (
152-
<CountdownCircleTimer
153-
{...fixture}
154-
duration={duration}
155-
isPlaying={isPlaying}
156-
onComplete={onComplete}
157-
>
158-
{({ remainingTime }) => <Text>{remainingTime}</Text>}
159-
</CountdownCircleTimer>
160-
)
161-
const { getByText, rerender } = render(component(true))
162-
163-
act(() => {
164-
global.timeTravel(1000)
165-
})
166-
167-
expect(getByText('0')).toBeTruthy()
168-
expect(onComplete).toHaveBeenCalledWith(1)
169-
170-
act(() => {
171-
jest.runOnlyPendingTimers()
172-
})
129+
it('should call onComplete at the end of the countdown', async () => {
130+
const onComplete = jest.fn()
131+
const { findByText } = render(
132+
<CountdownCircleTimer
133+
{...fixture}
134+
duration={1}
135+
isPlaying
136+
onComplete={onComplete}
137+
>
138+
{({ remainingTime }) => <Text>{remainingTime}</Text>}
139+
</CountdownCircleTimer>
140+
)
173141

174-
expect(getByText('1')).toBeTruthy()
175-
rerender(component(false))
176-
})
142+
expect(await findByText('0')).toBeTruthy()
143+
expect(onComplete).toHaveBeenCalledWith(1)
177144
})
178145

179146
it('should clear repeat timeout when the component is unmounted', () => {

packages/mobile/__tests__/__snapshots__/CountdownCircleTimer.test.js.snap

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,105 @@ exports[`snapshot tests renders 1`] = `
7979
</View>
8080
`;
8181

82+
exports[`snapshot tests renders correctly when color duration is not provided 1`] = `
83+
<View
84+
accessibilityLabel="Countdown timer"
85+
accessible={true}
86+
style={
87+
Object {
88+
"height": 180,
89+
"position": "relative",
90+
"width": 180,
91+
}
92+
}
93+
>
94+
<RNSVGSvgView
95+
bbHeight={180}
96+
bbWidth={180}
97+
focusable={false}
98+
height={180}
99+
style={
100+
Array [
101+
Object {
102+
"backgroundColor": "transparent",
103+
"borderWidth": 0,
104+
},
105+
Object {
106+
"flex": 0,
107+
"height": 180,
108+
"width": 180,
109+
},
110+
]
111+
}
112+
width={180}
113+
>
114+
<RNSVGGroup>
115+
<RNSVGPath
116+
d="m 90,6
117+
a 84,84 0 1,0 0,168
118+
a 84,84 0 1,0 0,-168"
119+
fill={null}
120+
propList={
121+
Array [
122+
"fill",
123+
"stroke",
124+
"strokeWidth",
125+
]
126+
}
127+
stroke={4292467161}
128+
strokeWidth={12}
129+
/>
130+
<RNSVGPath
131+
d="m 90,6
132+
a 84,84 0 1,0 0,168
133+
a 84,84 0 1,0 0,-168"
134+
fill={null}
135+
propList={
136+
Array [
137+
"fill",
138+
"stroke",
139+
"strokeWidth",
140+
"strokeDasharray",
141+
"strokeDashoffset",
142+
"strokeLinecap",
143+
]
144+
}
145+
stroke={4278207607}
146+
strokeDasharray={
147+
Array [
148+
527.7875658030853,
149+
527.7875658030853,
150+
]
151+
}
152+
strokeDashoffset={null}
153+
strokeLinecap={1}
154+
strokeWidth={12}
155+
/>
156+
</RNSVGGroup>
157+
</RNSVGSvgView>
158+
<View
159+
accessibilityElementsHidden={true}
160+
importantForAccessibility="no-hide-descendants"
161+
style={
162+
Object {
163+
"alignItems": "center",
164+
"display": "flex",
165+
"height": "100%",
166+
"justifyContent": "center",
167+
"left": 0,
168+
"position": "absolute",
169+
"top": 0,
170+
"width": "100%",
171+
}
172+
}
173+
>
174+
<Text>
175+
10
176+
</Text>
177+
</View>
178+
</View>
179+
`;
180+
82181
exports[`snapshot tests renders with different trail stroke width 1`] = `
83182
<View
84183
accessibilityLabel="Countdown timer"

packages/mobile/jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = {
22
preset: 'react-native',
3-
setupFiles: ['./jest/setup.js'],
43
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
54
transformIgnorePatterns: [
65
'node_modules/(?!(@react-native|react-native|react-native-svg)/)',

packages/mobile/jest/setup.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
"devDependencies": {
3838
"@countdown-circle-timer/shared": "^2.5.0",
39-
"@testing-library/jest-native": "4.0.1",
39+
"@testing-library/jest-native": "4.0.2",
4040
"@testing-library/react-native": "7.2.0",
4141
"metro-react-native-babel-preset": "0.66.2",
4242
"mockdate": "3.0.5",

packages/web/jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
testEnvironment: 'jsdom',
3+
maxWorkers: 4,
4+
}

0 commit comments

Comments
 (0)