Skip to content

Commit

Permalink
✅ Add test and snapshot for TravelTimer.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlee-dev committed Aug 24, 2019
1 parent 9e6c13a commit 908983e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/__tests__/components/TravelTimer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { customRender } from '../../test-utils'
import TravelTimer from '../../components/TravelTimer'
import { defaultState } from '../../fixtures'

const customState = {
...defaultState,
ship: {
...defaultState.ship,
destination: {
name: 'Test Planet 2',
value: 50
},
isShipTraveling: true
}
}

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

exports[`<TravelTimer /> Should render the <TravelTimer /> component. 1`] = `
<DocumentFragment>
<div
class="StyledBox-sc-13pk1d4-0 IRSNj"
>
<h3
class="StyledHeading-sc-1rdh4aw-0 ftOecI"
>
Travel Timer
</h3>
<span>
8 minutes 20 seconds
</span>
</div>
</DocumentFragment>
`;

0 comments on commit 908983e

Please sign in to comment.