exercises icon indicating copy to clipboard operation
exercises copied to clipboard

Change the expected test case result for `throttle`.

Open mtso opened this issue 8 years ago • 2 comments

Changes the expected result of the throttle test case named: will execute every threshold ms to [0, 10, 20, 30, 40, 50]. Resolves #33.

mtso avatar Feb 24 '17 19:02 mtso

There really isn't a clean way to fix this as is. I've changed it to use a kicker. Let me know if that works for you https://github.com/kolodny/exercises/tree/fix-time-issues

kolodny avatar Feb 28 '17 22:02 kolodny

Thank you very much for putting in the time to improve the testing. This repository has been very educational for me.

I have gotten the test to pass several times, but it doesn't appear to work reliably. Using the test file with the kicker, I sometimes get AssertionError: [ 0, 10, 20, 30, 40, 50, 60 ] deepEqual [ 0, 10, 20, 30, 40, 50 ].

I have also gotten variable results like [ 0, 10, 20, 30, 40, 40, 50 ] with unexpected doubled values.

Here's the throttling function I'm using: https://gist.github.com/mtso/1e59a17ccebcba4123b60951072bb359

I recognize now that this might be trickier than I first imagined.

mtso avatar Mar 01 '17 06:03 mtso