fix: fixed trailing = false bug + added tests#688
Conversation
(tests and test files all by GPT-5.5, seems to work)
Test Results
29 tested, 29 passed, 0 failed in 48.4s · View logs Deploy Results
1 deployed, 1 passed, 0 failed in 35.9s · View logs |
(since they also relied on scheduler delays) and i could make it so you could cd into test and get the tests to run, but i don't want to make a test method that isn't completely in line with the CI/CD flow and the nevermore test flow because it's probably all very specific so i'm just going to remove everything tested here cause those tests were generated anyway
|
(did not want tests that rely on scheduler delays to impact future nevermore test runs) |
|
|
||
| function ThrottledFunction._scheduleTrailing<T...>(self: ThrottledFunction<T...>, delayTime: number, ...: T...) | ||
| self._trailingValue = table.pack(...) | ||
| task.delay(delayTime, function() |
There was a problem hiding this comment.
we should probably track this task and cancel it "if-and-only-if" it hasn't dispatched yet.
|
feel free to add tests, and then use jest.useFakeTimers() |
| end | ||
|
|
||
| -- If leading = true, will enable dispatching immediately upon the creation of this ThrottledFunction. | ||
| -- Else, will have to wait <timeout> seconds before it calls with the latest-called args. |
There was a problem hiding this comment.
should put this in a luau doc comments maybe?
thanks gpt for helping me out with jest : ) thanks gpt for helping me out with moonwave conventions : ))

(tests and test files all by GPT-5.5, seems to work)
(set place files to 0 cause i don't want them overwriting existing places and idk how open cloud works)