Improves the tests

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
Michael Weimann 2018-08-17 20:35:23 +02:00
parent 887737f706
commit 2de34d7778
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
1 changed files with 24 additions and 9 deletions

View File

@ -2615,11 +2615,17 @@ describe('OCA.Files.FileList tests', function() {
});
describe('Sorting files', function() {
/**
* Set any user id before tests.
*/
var getCurrentUserStub;
beforeEach(function() {
OC.currentUser = 1;
getCurrentUserStub = sinon.stub(OC, 'getCurrentUser').returns({
uid: 1,
displayName: 'user1'
});
});
afterEach(function() {
getCurrentUserStub.restore();
});
it('Toggles the sort indicator when clicking on a column header', function() {
@ -2748,11 +2754,20 @@ describe('OCA.Files.FileList tests', function() {
sortStub.restore();
});
it('doesn\'t send a sort update request if there is no user logged in', function() {
OC.currentUser = false;
fileList.$el.find('.column-size .columntitle').click();
// check if there was no request
expect(fakeServer.requests.length).toEqual(0);
describe('if no user logged in', function() {
beforeEach(function() {
getCurrentUserStub.returns({
uid: null,
displayName: 'Guest'
});
});
it('shouldn\'t send an update sort order request', function() {
OC.currentUser = false;
fileList.$el.find('.column-size .columntitle').click();
// check if there was no request
expect(fakeServer.requests.length).toEqual(0);
});
});
describe('with favorites', function() {