Browse Source

Fix core tests by stubbing debounce

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
tags/v25.0.0beta1
Vincent Petry 1 year ago
parent
commit
3df85205b4
No account linked to committer's email address
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      core/js/tests/specs/coreSpec.js

+ 10
- 0
core/js/tests/specs/coreSpec.js View File

*/ */


describe('Core base tests', function() { 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() { afterEach(function() {
// many tests call window.initCore so need to unregister global events // many tests call window.initCore so need to unregister global events
// ideally in the future we'll need a window.unloadCore() function // ideally in the future we'll need a window.unloadCore() function
$(document).off('beforeunload.main'); $(document).off('beforeunload.main');
OC._userIsNavigatingAway = false; OC._userIsNavigatingAway = false;
OC._reloadCalled = false; OC._reloadCalled = false;
debounceStub.restore();
}); });
describe('Base values', function() { describe('Base values', function() {
it('Sets webroots', function() { it('Sets webroots', function() {

Loading…
Cancel
Save