Skip to content

Commit

Permalink
chore: tests 'work' but boy they complain a lot
Browse files Browse the repository at this point in the history
chore: integrated xcarpentier#475 from kanimetov
  • Loading branch information
mrflip committed Sep 22, 2022
1 parent c99afdc commit 5b1665f
Show file tree
Hide file tree
Showing 5 changed files with 40,987 additions and 167 deletions.
2 changes: 2 additions & 0 deletions .rgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/assets/data/countries-emoji.json
data/countries*.json
46 changes: 40 additions & 6 deletions __tests__/CountryPicker.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
import React from 'react'

import {setImmediate} from 'timers'

import TestRenderer from 'react-test-renderer';

import CountryPicker from '../src/'

it('CountryPicker can be created', () => {
const picker = TestRenderer.create(
<CountryPicker countryCode={'US'} onSelect={() => {}} />,
)
expect(picker).toBeDefined()
expect(picker).toMatchSnapshot()
describe('CountryPicker', () => {
// beforeAll(() => { jest.useFakeTimers() })
// afterAll(() => { jest.useRealTimers() })

it('CountryPicker with default options', async () => {
const picker = TestRenderer.create(
<CountryPicker countryCode={'GB'} onSelect={() => {}} withModal={false} />,
)
await new Promise((yay) => setTimeout(yay, 1000))
expect(picker).toBeDefined()
expect(picker).toMatchSnapshot()
})

it('CountryPicker with translation', async () => {
const picker = TestRenderer.create(
<CountryPicker translation="spa" countryCode={'GB'} onSelect={() => {}} withModal={false} />,
)
await new Promise((yay) => setTimeout(yay, 1000))
expect(picker).toBeDefined()
expect(picker).toMatchSnapshot()
})

})

// it('CountryPicker with translation', async () => {
// const picker = TestRenderer.create(
// <CountryPicker countryCode={'UA'} translation="fra" onSelect={() => {}}/>,
// )
// expect(picker).toBeDefined()
// expect(picker).toMatchSnapshot()
// })

// it('CountryPicker without modal', () => {
// const picker = TestRenderer.create(
// <CountryPicker countryCode={'US'} onSelect={() => {}} withModal={false} />,
// )
// expect(picker).toBeDefined()
// expect(picker).toMatchSnapshot()
// })
Loading

0 comments on commit 5b1665f

Please sign in to comment.