Skip to content

Commit

Permalink
Fix core tests by stubbing debounce
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Jul 27, 2022
1 parent c9c2a6e commit 419cb21
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/js/tests/specs/coreSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand Down

0 comments on commit 419cb21

Please sign in to comment.