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.
This commit is contained in:
aadijoshi 2020-06-16 18:51:17 +05:30 committed by GitHub
parent 0ef2dd3ae4
commit 393f1ce33d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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() {