Skip to content

Commit

Permalink
Merge 2208b6b into a978b05
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Lee committed Aug 22, 2019
2 parents a978b05 + 2208b6b commit 73f5dd2
Show file tree
Hide file tree
Showing 23 changed files with 1,570 additions and 21 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

<div align="center">

[![NPM Version][npm-image]][npm-url]
[![Build Status][travis]][travis]
[![Coverage Status][coverage-badge]][coverage-link]

</div>

Expand Down Expand Up @@ -44,6 +46,6 @@ A game about space and junk.
[npm-downloads]: https://img.shields.io/npm/dt/hermes-gaame.svg
[npm-url]: https://www.npmjs.com/package/hermes-gaame
[size-image]: https://img.shields.io/bundlephobia/minzip/hermes-game.svg
[coverage-badge]: https://coveralls.io/repos/github/alexlee-dev/hermes/badge.svg?branch=master
[coverage-badge]: https://coveralls.io/repos/github/alexlee-dev/hermes/badge.svg?branch=develop
[coverage-link]: https://coveralls.io/github/alexlee-dev/hermes?branch=master
[travis]: https://travis-ci.org/alexlee-dev/hermes.svg?branch=master
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@
"uuid": "^3.3.3"
},
"devDependencies": {
"@testing-library/dom": "^6.1.0",
"@testing-library/react": "^9.1.3",
"coveralls": "^3.0.6",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0"
"enzyme-adapter-react-16": "^1.14.0",
"jsdom": "^15.1.1",
"jsdom-global": "^3.0.2",
"redux-mock-store": "^1.5.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"test": "react-scripts test",
"test:coveralls": "jest --coverage --collectCoverageFrom=src/**/* --coverageReporters=text-lcov | coveralls"
"test:coverage": "yarn test --coverage --watchAll=false --collectCoverageFrom=src/components/**/* --collectCoverageFrom=src/views/**/*",
"test:coveralls": "yarn test --coverage --watchAll=false --collectCoverageFrom=src/components/**/* --collectCoverageFrom=src/views/**/* --coverageReporters=text-lcov | coveralls"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
10 changes: 7 additions & 3 deletions src/__tests__/App.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
describe('Fake Test', () => {
it('Should pass.', () => {
expect(1 + 1).toBe(2)
import { customRender } from '../test-utils'
import App from '../App'

describe('<App />', () => {
it('Should render the <App /> component.', () => {
const container = customRender({ component: App })
expect(container.asFragment()).toMatchSnapshot()
})
})
86 changes: 86 additions & 0 deletions src/__tests__/__snapshots__/App.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<App /> Should render the <App /> component. 1`] = `
<DocumentFragment>
<div
class="StyledBox-sc-13pk1d4-0 cXRmiT"
>
<h1
class="StyledHeading-sc-1rdh4aw-0 rfVJR"
>
Hermes
</h1>
<span>
10 minutes 0 seconds
</span>
<div
class="StyledBox-sc-13pk1d4-0 CAsMy"
>
<h2
class="StyledHeading-sc-1rdh4aw-0 gBloPj"
>
Cash:
</h2>
<span
class="StyledText-sc-1sadyjn-0 fWSbXS"
>
100
</span>
</div>
<div
class="StyledBox-sc-13pk1d4-0 dfMVfp"
>
<select
data-testid="view-selector"
>
<option>
Ship
</option>
<option>
Planets
</option>
</select>
</div>
<div>
<h2>
Your Ship
</h2>
<h3>
Cargo
</h3>
<h3>
Location:
</h3>
<div
class="StyledBox-sc-13pk1d4-0 MmWcm"
>
<span
class="StyledText-sc-1sadyjn-0 isVaoK"
>
Value:
</span>
<div
class="StyledBox__StyledBoxGap-sc-13pk1d4-1 hPsznL"
/>
<span
class="StyledText-sc-1sadyjn-0 gNZQxf"
/>
<div
class="StyledBox__StyledBoxGap-sc-13pk1d4-1 hPsznL"
/>
<span
class="StyledText-sc-1sadyjn-0 isVaoK"
>
Name:
</span>
<div
class="StyledBox__StyledBoxGap-sc-13pk1d4-1 hPsznL"
/>
<span
class="StyledText-sc-1sadyjn-0 gNZQxf"
/>
</div>
</div>
</div>
</DocumentFragment>
`;
9 changes: 9 additions & 0 deletions src/__tests__/components/CashDisplay.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { customRender } from '../../test-utils'
import CashDisplay from '../../components/CashDisplay'

describe('<CashDisplay />', () => {
it('Should render the <CashDisplay /> component.', () => {
const container = customRender({ component: CashDisplay })
expect(container.asFragment()).toMatchSnapshot()
})
})
9 changes: 9 additions & 0 deletions src/__tests__/components/ItemTimer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { customRender } from '../../test-utils'
import ItemTimer from '../../components/ItemTimer'

describe('<ItemTimer />', () => {
it('Should render the <ItemTimer /> component.', () => {
const container = customRender({ component: ItemTimer })
expect(container.asFragment()).toMatchSnapshot()
})
})
9 changes: 9 additions & 0 deletions src/__tests__/components/Title.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Title from '../../components/Title'
import { customRender } from '../../test-utils'

describe('<Title />', () => {
it('Should render the <Title /> component.', () => {
const container = customRender({ component: Title })
expect(container.asFragment()).toMatchSnapshot()
})
})
20 changes: 20 additions & 0 deletions src/__tests__/components/ViewSelector.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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 = 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')
})
})
20 changes: 20 additions & 0 deletions src/__tests__/components/__snapshots__/CashDisplay.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<CashDisplay /> Should render the <CashDisplay /> component. 1`] = `
<DocumentFragment>
<div
class="StyledBox-sc-13pk1d4-0 CAsMy"
>
<h2
class="StyledHeading-sc-1rdh4aw-0 gBloPj"
>
Cash:
</h2>
<span
class="StyledText-sc-1sadyjn-0 fWSbXS"
>
100
</span>
</div>
</DocumentFragment>
`;
9 changes: 9 additions & 0 deletions src/__tests__/components/__snapshots__/ItemTimer.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<ItemTimer /> Should render the <ItemTimer /> component. 1`] = `
<DocumentFragment>
<span>
10 minutes 0 seconds
</span>
</DocumentFragment>
`;
11 changes: 11 additions & 0 deletions src/__tests__/components/__snapshots__/Title.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Title /> Should render the <Title /> component. 1`] = `
<DocumentFragment>
<h1
class="StyledHeading-sc-1rdh4aw-0 rfVJR"
>
Hermes
</h1>
</DocumentFragment>
`;
20 changes: 20 additions & 0 deletions src/__tests__/components/__snapshots__/ViewSelector.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<ViewSelector /> Should render the <ViewSelector /> component. 1`] = `
<DocumentFragment>
<div
class="StyledBox-sc-13pk1d4-0 dfMVfp"
>
<select
data-testid="view-selector"
>
<option>
Ship
</option>
<option>
Planets
</option>
</select>
</div>
</DocumentFragment>
`;
Loading

0 comments on commit 73f5dd2

Please sign in to comment.