-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π Merge pull request #47 from alexlee-dev/feature/test-redux
β Update Test Strategy
- Loading branch information
Showing
17 changed files
with
1,214 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import { Provider } from 'react-redux' | ||
import { defaultState, mockStore } from '../fixtures' | ||
import { customRender } from '../test-utils' | ||
import App from '../App' | ||
|
||
describe('<App />', () => { | ||
it('Should render the <App /> component.', () => { | ||
const container = render( | ||
<Provider store={mockStore(defaultState)}> | ||
<App /> | ||
</Provider> | ||
) | ||
const container = customRender({ component: App }) | ||
expect(container.asFragment()).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import { Provider } from 'react-redux' | ||
import { defaultState, mockStore } from '../../fixtures' | ||
import { customRender } from '../../test-utils' | ||
import CashDisplay from '../../components/CashDisplay' | ||
|
||
describe('<CashDisplay />', () => { | ||
it('Should render the <CashDisplay /> component.', () => { | ||
const container = render( | ||
<Provider store={mockStore(defaultState)}> | ||
<CashDisplay /> | ||
</Provider> | ||
) | ||
const container = customRender({ component: CashDisplay }) | ||
expect(container.asFragment()).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import { Provider } from 'react-redux' | ||
import { defaultState, mockStore } from '../../fixtures' | ||
import { customRender } from '../../test-utils' | ||
import ItemTimer from '../../components/ItemTimer' | ||
|
||
describe('<ItemTimer />', () => { | ||
it('Should render the <ItemTimer /> component.', () => { | ||
const container = render( | ||
<Provider store={mockStore(defaultState)}> | ||
<ItemTimer /> | ||
</Provider> | ||
) | ||
const container = customRender({ component: ItemTimer }) | ||
expect(container.asFragment()).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import Title from '../../components/Title' | ||
import { customRender } from '../../test-utils' | ||
|
||
describe('<Title />', () => { | ||
it('Should render the <Title /> component.', () => { | ||
const container = render(<Title />) | ||
const container = customRender({ component: Title }) | ||
expect(container.asFragment()).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import { Provider } from 'react-redux' | ||
import { defaultState, mockStore } from '../../fixtures' | ||
import { fireEvent, waitForElement } from '@testing-library/react' | ||
import { customRender } from '../../test-utils' | ||
import ViewSelector from '../../components/ViewSelector' | ||
|
||
describe('<ViewSelector />', () => { | ||
it('Should render the <ViewSelector /> component.', () => { | ||
const container = render( | ||
<Provider store={mockStore(defaultState)}> | ||
<ViewSelector /> | ||
</Provider> | ||
) | ||
const container = customRender({ component: ViewSelector }) | ||
expect(container.asFragment()).toMatchSnapshot() | ||
}) | ||
|
||
it('Should handle changing the ViewSelector.', async () => { | ||
const { getByTestId } = customRender({ component: ViewSelector }) | ||
|
||
const selector = await waitForElement(() => getByTestId('view-selector')) | ||
|
||
expect(getByTestId('view-selector').value).toBe('Ship') | ||
fireEvent.change(selector, { target: { value: 'Planets' } }) | ||
expect(getByTestId('view-selector').value).toBe('Planets') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.