Skip to content

Commit

Permalink
✅ Add test for ItemTimer with mock
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlee-dev committed Aug 23, 2019
1 parent faf744b commit 9a82eba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/__tests__/components/ItemTimer.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React from 'react';
import { customRender } from '../../test-utils'
import ItemTimer from '../../components/ItemTimer'

jest.mock('../../components/ItemTimer', () => {
return () => <span>MockedTime</span>
jest.mock('../../util', () => {
const moment = require('moment')
const mockCreateDuration = () => moment.duration({ minutes: 60, seconds: 0 })
return {
createDuration: mockCreateDuration
}
})

describe('<ItemTimer />', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`<ItemTimer /> Should render the <ItemTimer /> component. 1`] = `
<DocumentFragment>
<span>
MockedTime
0 minutes 0 seconds
</span>
</DocumentFragment>
`;

0 comments on commit 9a82eba

Please sign in to comment.