-
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.
✅ Add test and snapshot for TravelTimer.
- Loading branch information
alexlee-dev
committed
Aug 24, 2019
1 parent
9e6c13a
commit 908983e
Showing
2 changed files
with
43 additions
and
0 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
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
18
src/__tests__/components/__snapshots__/TravelTimer.test.js.snap
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 |
---|---|---|
@@ -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> | ||
`; |