From f689a897b8778a78bddcf059f34d3d71ba5306b7 Mon Sep 17 00:00:00 2001 From: Bruce Harris Date: Wed, 6 Dec 2017 10:28:34 -0500 Subject: [PATCH] =?UTF-8?q?Failing=20test=20=E2=80=93=20validate=20delay?= =?UTF-8?q?=20period?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/LoadingIndicator.js | 2 +- src/components/LoadingIndicator.test.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/LoadingIndicator.js b/src/components/LoadingIndicator.js index d616277..8223e9f 100644 --- a/src/components/LoadingIndicator.js +++ b/src/components/LoadingIndicator.js @@ -12,7 +12,7 @@ export default class LoadingIndicator extends Component { componentWillMount () { this._delayTimer = setTimeout( - () => this.setState({ isPastDelay: true }), 200 + () => this.setState({ isPastDelay: true }), 100 ) } diff --git a/src/components/LoadingIndicator.test.js b/src/components/LoadingIndicator.test.js index 2932f31..e371ff1 100644 --- a/src/components/LoadingIndicator.test.js +++ b/src/components/LoadingIndicator.test.js @@ -36,7 +36,12 @@ describe('LoadingIndicator', () => {
ahoy!
); + + expect(setTimeout.mock.calls.length).toEqual(1); + expect(setTimeout.mock.calls[0][1]).toEqual(200); + jest.runAllTimers(); + expect(wrapper.html()).toBe('
loading...
'); wrapper.unmount(); });