ryanseddon / redux-debounced

Debounce middleware for Redux
166 stars 11 forks source link

Error in the "debounced action can be cancelled" test #9

Closed dispix closed 1 year ago

dispix commented 8 years ago

In the test/index.js file, there is a difference between the test description and the actual test. Modifying the test from calledTwice to calledThrice actually issues an error during npm run test.

it('clearTimeout is called three times', () => {
  assert.ok(global.clearTimeout.calledTwice); // Should be calledThrice according to the description
});

So is the description falsy or is the test actually wrong ? In the latter case, it may mean something is not working as intended.

ryanseddon commented 8 years ago

Think that's just an error in the text. I call dispatch twice which will call clearTimeout once and then I trigger a cancel action which will trigger clearTimeout again. Good catch.

dispix commented 8 years ago

I corrected it in my first commit in PR #10