Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weimann <mail@michael-weimann.eu>2018-08-17 21:35:23 +0300
committerMichael Weimann <mail@michael-weimann.eu>2018-08-17 21:35:23 +0300
commit2de34d77780a60de198ef82a3f17292db9f668a4 (patch)
tree83a8aa0ac377aa799362c9f27ffeb3bf165c3d3c /apps/files/tests
parent887737f7067a6e9872fb0843ee5bac8a540fd684 (diff)
Improves the tests
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
Diffstat (limited to 'apps/files/tests')
-rw-r--r--apps/files/tests/js/filelistSpec.js33
1 files changed, 24 insertions, 9 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index d140299d228..50b336902b9 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -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() {