Skip to content

Commit 7607748

Browse files
committed
chore: tests 'work' but boy they complain a lot
chore: integrated xcarpentier#475 from kanimetov
1 parent 38b59f7 commit 7607748

File tree

5 files changed

+40987
-167
lines changed

5 files changed

+40987
-167
lines changed

.rgignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/assets/data/countries-emoji.json
2+
data/countries*.json

__tests__/CountryPicker.test.tsx

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
import React from 'react'
22

3+
import {setImmediate} from 'timers'
4+
35
import TestRenderer from 'react-test-renderer';
46

57
import CountryPicker from '../src/'
68

7-
it('CountryPicker can be created', () => {
8-
const picker = TestRenderer.create(
9-
<CountryPicker countryCode={'US'} onSelect={() => {}} />,
10-
)
11-
expect(picker).toBeDefined()
12-
expect(picker).toMatchSnapshot()
9+
describe('CountryPicker', () => {
10+
// beforeAll(() => { jest.useFakeTimers() })
11+
// afterAll(() => { jest.useRealTimers() })
12+
13+
it('CountryPicker with default options', async () => {
14+
const picker = TestRenderer.create(
15+
<CountryPicker countryCode={'GB'} onSelect={() => {}} withModal={false} />,
16+
)
17+
await new Promise((yay) => setTimeout(yay, 1000))
18+
expect(picker).toBeDefined()
19+
expect(picker).toMatchSnapshot()
20+
})
21+
22+
it('CountryPicker with translation', async () => {
23+
const picker = TestRenderer.create(
24+
<CountryPicker translation="spa" countryCode={'GB'} onSelect={() => {}} withModal={false} />,
25+
)
26+
await new Promise((yay) => setTimeout(yay, 1000))
27+
expect(picker).toBeDefined()
28+
expect(picker).toMatchSnapshot()
29+
})
30+
1331
})
32+
33+
// it('CountryPicker with translation', async () => {
34+
// const picker = TestRenderer.create(
35+
// <CountryPicker countryCode={'UA'} translation="fra" onSelect={() => {}}/>,
36+
// )
37+
// expect(picker).toBeDefined()
38+
// expect(picker).toMatchSnapshot()
39+
// })
40+
41+
// it('CountryPicker without modal', () => {
42+
// const picker = TestRenderer.create(
43+
// <CountryPicker countryCode={'US'} onSelect={() => {}} withModal={false} />,
44+
// )
45+
// expect(picker).toBeDefined()
46+
// expect(picker).toMatchSnapshot()
47+
// })

0 commit comments

Comments
 (0)