We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 853b98a commit 816309bCopy full SHA for 816309b
packages/replay/test/unit/util/debounce.test.ts
@@ -240,4 +240,20 @@ describe('debounce', () => {
240
const returnValue = debouncedCallback.flush();
241
expect(returnValue).toBe(undefined);
242
});
243
+
244
+ it('should handle equal wait and maxWait values and only invoke func once', () => {
245
+ const callback = jest.fn().mockReturnValue('foo');
246
+ const debouncedCallback = debounce(callback, 100, { maxWait: 100 });
247
248
+ debouncedCallback();
249
+ jest.advanceTimersByTime(100);
250
251
+ expect(callback).toHaveBeenCalledTimes(1);
252
253
+ const retval = debouncedCallback();
254
+ expect(retval).toBe('foo');
255
256
257
+ expect(callback).toHaveBeenCalledTimes(2);
258
+ });
259
0 commit comments