From cf22336a6938a2842b4da1e705e94d77f6ec8309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:20:29 +0200 Subject: [PATCH] fix: js tests for jasmine 5.x.x --- apps/files/tests/js/favoritespluginspec.js | 1 + apps/files_external/tests/js/settingsSpec.js | 15 ------------- apps/files_sharing/tests/js/shareSpec.js | 4 ---- apps/files_trashbin/tests/js/filelistSpec.js | 23 -------------------- core/js/tests/specHelper.js | 4 +++- core/js/tests/specs/setupchecksSpec.js | 21 +++++++++--------- 6 files changed, 15 insertions(+), 53 deletions(-) diff --git a/apps/files/tests/js/favoritespluginspec.js b/apps/files/tests/js/favoritespluginspec.js index 35932557fe4b..0ff5be39f2c3 100644 --- a/apps/files/tests/js/favoritespluginspec.js +++ b/apps/files/tests/js/favoritespluginspec.js @@ -27,6 +27,7 @@ describe('OCA.Files.FavoritesPlugin tests', function() { '' + '' ); + OCA.Files.App.initialize(); OC.Plugins.attach('OCA.Files.App', Plugin); fileList = Plugin.showFileList($('#app-content-favorites')); }); diff --git a/apps/files_external/tests/js/settingsSpec.js b/apps/files_external/tests/js/settingsSpec.js index 5a7611fa7c15..943fefd399f1 100644 --- a/apps/files_external/tests/js/settingsSpec.js +++ b/apps/files_external/tests/js/settingsSpec.js @@ -308,15 +308,6 @@ describe('OCA.External.Settings tests', function() { expect(storage.validate()).toBe(false); }); }); - describe('update storage', function() { - // TODO - }); - describe('delete storage', function() { - // TODO - }); - describe('recheck storages', function() { - // TODO - }); describe('mount options dropdown', function() { var $tr; var $td; @@ -414,12 +405,6 @@ describe('OCA.External.Settings tests', function() { }); }); }); - describe('applicable user list', function() { - // TODO: test select2 retrieval logic - }); - describe('allow user mounts section', function() { - // TODO: test allowUserMounting section - }); describe('mountConfigLoaded event is triggered', function() { var view; diff --git a/apps/files_sharing/tests/js/shareSpec.js b/apps/files_sharing/tests/js/shareSpec.js index 9448382657b0..dca8dae03d84 100644 --- a/apps/files_sharing/tests/js/shareSpec.js +++ b/apps/files_sharing/tests/js/shareSpec.js @@ -72,10 +72,6 @@ describe('OCA.Sharing.Util tests', function() { fileList.destroy(); fileList = null; }); - - describe('Sharing data in table row', function() { - // TODO: test data-permissions, data-share-owner, etc - }); describe('Share action icon', function() { it('do not shows share text when not shared', function() { var $action, $tr; diff --git a/apps/files_trashbin/tests/js/filelistSpec.js b/apps/files_trashbin/tests/js/filelistSpec.js index 0e164de9857b..277c3e2811b3 100644 --- a/apps/files_trashbin/tests/js/filelistSpec.js +++ b/apps/files_trashbin/tests/js/filelistSpec.js @@ -211,29 +211,6 @@ describe('OCA.Trashbin.FileList tests', function() { expect(fileList.$el.find('tbody tr .filesize').length).toEqual(0); }); }); - describe('File actions', function() { - describe('Deleting single files', function() { - // TODO: checks ajax call - // TODO: checks spinner - // TODO: remove item after delete - // TODO: bring back item if delete failed - }); - describe('Restoring single files', function() { - // TODO: checks ajax call - // TODO: checks spinner - // TODO: remove item after restore - // TODO: bring back item if restore failed - }); - }); - describe('file previews', function() { - // TODO: check that preview URL is going through files_trashbin - }); - describe('loading file list', function() { - // TODO: check that ajax URL is going through files_trashbin - }); - describe('breadcrumbs', function() { - // TODO: test label + URL - }); describe('elementToFile', function() { var $tr; diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js index 23eec8711f67..35d604228daa 100644 --- a/core/js/tests/specHelper.js +++ b/core/js/tests/specHelper.js @@ -97,7 +97,9 @@ window.oc_config = { blacklist_files_regex: '\.(part|filepart)$' }; window.oc_appconfig = { - core: {} + core: {}, + files: {}, + files_sharing: {} }; window.oc_defaults = {}; window.oc_requesttoken = 'testrequesttoken'; diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 759e5923ccc0..96ba8ec633f3 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -101,9 +101,9 @@ describe('OC.SetupChecks tests', function() { oc_dataURL = "data"; it('should return an error if data directory is not protected', function(done) { + suite.server.respondWith([ 200, { "Content-Type": "text/plain" }, '*cough*HTACCESSFAIL*cough*']); var async = OC.SetupChecks.checkDataProtected(); - - suite.server.requests[0].respond(200, {'Content-Type': 'text/plain'}, '*cough*HTACCESSFAIL*cough*'); + suite.server.respond(); async.done(function( data, s, x ){ expect(data).toEqual([ @@ -116,9 +116,9 @@ describe('OC.SetupChecks tests', function() { }); it('should not return an error if data directory is protected', function(done) { + suite.server.respondWith([ 403, { "Content-Type": "text/plain" }, '403']); var async = OC.SetupChecks.checkDataProtected(); - - suite.server.requests[0].respond(403); + suite.server.respond(); async.done(function( data, s, x ){ expect(data).toEqual([]); @@ -127,9 +127,9 @@ describe('OC.SetupChecks tests', function() { }); it('should not return an error if data directory is protected and redirects to main page', function(done) { + suite.server.respondWith([200, {'Content-Type': 'text/plain'}, 'blah']); var async = OC.SetupChecks.checkDataProtected(); - - suite.server.requests[0].respond(200, {'Content-Type': 'text/plain'}, 'blah'); + suite.server.respond(); async.done(function( data, s, x ){ expect(data).toEqual([]); @@ -153,9 +153,7 @@ describe('OC.SetupChecks tests', function() { describe('checkSetup', function() { it('should return an error if server has no internet connection', function(done) { - var async = OC.SetupChecks.checkSetup(); - - suite.server.requests[0].respond( + suite.server.respondWith([ 200, { 'Content-Type': 'application/json' @@ -168,7 +166,10 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, }) - ); + ]); + var async = OC.SetupChecks.checkSetup(); + suite.server.respond(); + async.done(function( data, s, x ){ expect(data).toEqual([