From 3df85205b49d75fef8996af07526a81083857615 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 26 Jul 2022 15:44:57 +0200 Subject: [PATCH] Fix core tests by stubbing debounce Signed-off-by: Vincent Petry --- core/js/tests/specs/coreSpec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index 8adea2123e0..7f5a8b10d89 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -20,6 +20,15 @@ */ describe('Core base tests', function() { + var debounceStub + beforeEach(function() { + debounceStub = sinon.stub(_, 'debounce').callsFake(function(callback) { + return function() { + // defer instead of debounce, to make it work with clock + _.defer(callback); + }; + }); + }); afterEach(function() { // many tests call window.initCore so need to unregister global events // ideally in the future we'll need a window.unloadCore() function @@ -28,6 +37,7 @@ describe('Core base tests', function() { $(document).off('beforeunload.main'); OC._userIsNavigatingAway = false; OC._reloadCalled = false; + debounceStub.restore(); }); describe('Base values', function() { it('Sets webroots', function() { -- 2.39.5