Skip to content

Commit

Permalink
Failing test – validate delay period
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceharris committed Dec 6, 2017
1 parent 8a75ba5 commit f689a89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/LoadingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class LoadingIndicator extends Component {

componentWillMount () {
this._delayTimer = setTimeout(
() => this.setState({ isPastDelay: true }), 200
() => this.setState({ isPastDelay: true }), 100
)
}

Expand Down
5 changes: 5 additions & 0 deletions src/components/LoadingIndicator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ describe('LoadingIndicator', () => {
<div>ahoy!</div>
</LoadingIndicator>
);

expect(setTimeout.mock.calls.length).toEqual(1);
expect(setTimeout.mock.calls[0][1]).toEqual(200);

jest.runAllTimers();

expect(wrapper.html()).toBe('<div>loading...</div>');
wrapper.unmount();
});
Expand Down

0 comments on commit f689a89

Please sign in to comment.