Fix unit tests affected by side effects
The notification tests were not restoring the clock properly, but indirectly helped other tests pass. Since now we're restoring the clock properly, the other tests were fixed to still work.
This commit is contained in:
parent
8ea80e114a
commit
27544144ce
|
@ -20,9 +20,10 @@
|
|||
*/
|
||||
|
||||
describe('OCA.Files.FileActions tests', function() {
|
||||
var fileList, fileActions;
|
||||
var fileList, fileActions, clock;
|
||||
|
||||
beforeEach(function() {
|
||||
clock = sinon.useFakeTimers();
|
||||
// init horrible parameters
|
||||
var $body = $('#testArea');
|
||||
$body.append('<input type="hidden" id="dir" value="/subdir"></input>');
|
||||
|
@ -63,6 +64,7 @@ describe('OCA.Files.FileActions tests', function() {
|
|||
fileActions = null;
|
||||
fileList.destroy();
|
||||
fileList = undefined;
|
||||
clock.restore();
|
||||
$('#dir, #permissions, #filestable').remove();
|
||||
});
|
||||
it('calling clear() clears file actions', function() {
|
||||
|
|
|
@ -22,14 +22,17 @@
|
|||
describe('OCA.SystemTags.SystemTagsInfoView tests', function() {
|
||||
var isAdminStub;
|
||||
var view;
|
||||
var clock;
|
||||
|
||||
beforeEach(function() {
|
||||
clock = sinon.useFakeTimers();
|
||||
view = new OCA.SystemTags.SystemTagsInfoView();
|
||||
$('#testArea').append(view.$el);
|
||||
isAdminStub = sinon.stub(OC, 'isUserAdmin').returns(true);
|
||||
});
|
||||
afterEach(function() {
|
||||
isAdminStub.restore();
|
||||
clock.restore();
|
||||
view.remove();
|
||||
view = undefined;
|
||||
});
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
*/
|
||||
|
||||
describe('OC.SystemTags.SystemTagsInputField tests', function() {
|
||||
var view, select2Stub;
|
||||
var view, select2Stub, clock;
|
||||
|
||||
beforeEach(function() {
|
||||
clock = sinon.useFakeTimers();
|
||||
var $container = $('<div class="testInputContainer"></div>');
|
||||
select2Stub = sinon.stub($.fn, 'select2');
|
||||
select2Stub.returnsThis();
|
||||
|
@ -31,6 +32,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() {
|
|||
afterEach(function() {
|
||||
select2Stub.restore();
|
||||
OC.SystemTags.collection.reset();
|
||||
clock.restore();
|
||||
view.remove();
|
||||
view = undefined;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue