|
1 | 1 | import React from 'react'
|
2 | 2 |
|
| 3 | +import {setImmediate} from 'timers' |
| 4 | + |
3 | 5 | import TestRenderer from 'react-test-renderer';
|
4 | 6 |
|
5 | 7 | import CountryPicker from '../src/'
|
6 | 8 |
|
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 | + |
13 | 31 | })
|
| 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