Skip to content

Commit

Permalink
improve test assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Jan 19, 2018
1 parent 703d51f commit c2965dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/debounce-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,29 @@ QUnit.test('debounce', function(assert) {
// let's schedule `debouncee` to run in 10ms
setTimeout(() => {
assert.equal(step++, 1);
assert.ok(!wasCalled);
assert.ok(!wasCalled, '@10ms, should not yet have been called');
bb.debounce(null, debouncee, 40);
}, 10);

// let's schedule `debouncee` to run again in 30ms
setTimeout(() => {
assert.equal(step++, 2);
assert.ok(!wasCalled);
assert.ok(!wasCalled, '@ 30ms, should not yet have been called');
bb.debounce(null, debouncee, 40);
}, 30);

// let's schedule `debouncee` to run yet again in 60ms
setTimeout(() => {
assert.equal(step++, 3);
assert.ok(!wasCalled);
assert.ok(!wasCalled, '@ 60ms, should not yet have been called');
bb.debounce(null, debouncee, 40);
}, 60);

// now, let's schedule an assertion to occur at 110ms,
// 10ms after `debouncee` has been called the last time
setTimeout(() => {
assert.equal(step++, 4);
assert.ok(wasCalled);
assert.ok(wasCalled, '@ 110ms should have been called');
}, 110);

// great, we've made it this far, there's one more thing
Expand Down

0 comments on commit c2965dc

Please sign in to comment.