Skip to content

Commit

Permalink
fix/tests: use require for loading components
Browse files Browse the repository at this point in the history
  • Loading branch information
3c1u committed Mar 23, 2022
1 parent 070502c commit 99ddd35
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion tests/station01.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react'
import renderer, { act } from 'react-test-renderer'
import { App } from '../src/App'
import { fetchMock } from './mock/fetch'

const { App } = require('../src/App') as { App: React.ComponentType<{}> }

describe('Station No.1', () => {
const fetch = jest.fn()
window.fetch = fetch
Expand Down
2 changes: 1 addition & 1 deletion tests/station02.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react'
import renderer, { act } from 'react-test-renderer'
import { App } from '../src/App'
import { fetchMock } from './mock/fetch'
import { createAsync } from './utils/createAsync'

const { App } = require('../src/App') as { App: React.ComponentType<{}> }

describe('Station No.2', () => {
const fetch = jest.fn()
Expand Down
3 changes: 2 additions & 1 deletion tests/station03.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react'
import { App } from '../src/App'
import { fetchMock } from './mock/fetch'
import { createAsync } from './utils/createAsync'

const { App } = require('../src/App') as { App: React.ComponentType<{}> }

describe('Station No.3', () => {
const fetch = jest.fn()
window.fetch = fetch
Expand Down
3 changes: 2 additions & 1 deletion tests/station04.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react'
import { act } from 'react-test-renderer'
import { App } from '../src/App'
import { fetchMock } from './mock/fetch'
import { createAsync } from './utils/createAsync'

const { App } = require('../src/App') as { App: React.ComponentType<{}> }

describe('Station No.4', () => {
const fetch = jest.fn()
window.fetch = fetch
Expand Down
3 changes: 2 additions & 1 deletion tests/station05.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react'
import renderer, { act } from 'react-test-renderer'
import { App } from '../src/App'
import { fetchMock } from './mock/fetch'
import { createAsync } from './utils/createAsync'

const { App } = require('../src/App') as { App: React.ComponentType<{}> }

describe('Station No.5', () => {
const fetch = jest.fn()
window.fetch = fetch
Expand Down
3 changes: 2 additions & 1 deletion tests/station06.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react'
import { act } from 'react-test-renderer'
import { App } from '../src/App'
import { imageUrl, fetchMock } from './mock/fetch'
import { createAsync } from './utils/createAsync'

const { App } = require('../src/App') as { App: React.ComponentType<{}> }

describe('<App />', () => {
const callback = {
run: (_: string) => {},
Expand Down
7 changes: 5 additions & 2 deletions tests/station11.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React from 'react'
import { act } from 'react-test-renderer'
import { App } from '../src/App'
import { DogListContainer } from '../src/DogListContainer'
import { fetchMock } from './mock/fetch'
import { createAsync } from './utils/createAsync'

const { App } = require('../src/App') as { App: React.ComponentType<{}> }
const { DogListContainer } = require('../src/DogListContainer') as {
DogListContainer: React.ComponentType<{}>
}

describe('<DogListContainer />', () => {
const fetch = jest.fn()
window.fetch = fetch
Expand Down

0 comments on commit 99ddd35

Please sign in to comment.