From 393f1ce33d65939073ad4ca917957d9f5ccb7c82 Mon Sep 17 00:00:00 2001 From: aadijoshi Date: Tue, 16 Jun 2020 18:51:17 +0530 Subject: [PATCH] Set fake timers after calling throttle Calling throttle before setting the fake timers will break any implementations that save a timestamp outside the wrapper function. --- .../09-call-apply-decorators/04-throttle/_js.view/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/_js.view/test.js b/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/_js.view/test.js index d2cf8e15..e671438f 100644 --- a/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/_js.view/test.js +++ b/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/_js.view/test.js @@ -7,8 +7,8 @@ describe("throttle(f, 1000)", function() { } before(function() { - f1000 = throttle(f, 1000); this.clock = sinon.useFakeTimers(); + f1000 = throttle(f, 1000); }); it("the first call runs now", function() {