Fix core tests by stubbing debounce

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
Vincent Petry 2022-07-26 15:44:57 +02:00
parent c9c2a6eb48
commit 419cb21fd6
No known key found for this signature in database
GPG key ID: E055D6A4D513575C

View file

@ -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() {