From a6b5cd83d0c00fca8d9cbf0df78cbc3ad11f93ab Mon Sep 17 00:00:00 2001 From: vkovtun <viktor.kovtun@id.ethz.ch> Date: Tue, 22 Aug 2023 21:37:05 +0200 Subject: [PATCH] SSDM-13926: Fixing the failing JS test. --- .../openbis-v3-api-test/html/index.html | 2 +- .../openbis-v3-api-test/html/test/common.js | 3 +++ .../html/test/test-import-export.js | 25 +++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/index.html b/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/index.html index 89e5b14b6d5..6e0e0f5b7fb 100644 --- a/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/index.html +++ b/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/index.html @@ -15,7 +15,7 @@ require.paths["test/qunit-report"] = testPath + "/lib/qunit/js/qunit-reporter-junit"; require.paths["test/naturalsort"] = testPath + "/lib/naturalsort/js/naturalSort"; - require.urlArgs = 'now=' + Date.now(); + // require.urlArgs = 'now=' + Date.now(); require.shim["test/qunit-report"] = { deps : [ 'test/qunit' ] diff --git a/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js b/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js index c891ce30216..718a7a2ee53 100644 --- a/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js +++ b/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js @@ -220,6 +220,9 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp this.PluginUpdate = dtos.PluginUpdate; this.WebAppSettings = dtos.WebAppSettings; + this.VocabularyDeletionOptions = dtos.VocabularyDeletionOptions; + this.VocabularyTermDeletionOptions = dtos.VocabularyTermDeletionOptions; + // operations this.GetSessionInformationOperation = dtos.GetSessionInformationOperation; diff --git a/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-import-export.js b/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-import-export.js index 8b090721d01..2c046b792f2 100644 --- a/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-import-export.js +++ b/test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-import-export.js @@ -110,15 +110,22 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', ' var fCheck = function(facade) { var criteria = new c.VocabularySearchCriteria(); criteria.withCode().thatEquals("VOCAB"); - facade.searchVocabularies(criteria, c.createVocabularyFetchOptions()).then(function(results) { - c.assertEqual(results.getTotalCount(), 3) - var objects = results.getObjects(); + criteria.withTerms(); + return facade.searchVocabularies(criteria, c.createVocabularyFetchOptions()).then(function(results) { + c.assertEqual(results.getTotalCount(), 1) + var vocabulary = (results.getObjects())[0]; - var codes = objects.map(function(object) { + c.assertEqual(vocabulary.code, "VOCAB"); + + var terms = vocabulary.getTerms(); + + c.assertEqual(terms.length, 3) + + var codes = terms.map(function(object) { return object.code; }).sort(); - var labels = objects.map(function(object) { + var labels = terms.map(function(object) { return object.label; }).sort(); @@ -129,6 +136,14 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', ' c.assertEqual(labels[0], "A"); c.assertEqual(labels[1], "B"); c.assertEqual(labels[2], "C"); + + // var options = new c.VocabularyTermDeletionOptions(); + // options.setReason("test reason"); + // facade.deleteVocabularyTerms([ "TERM_A", "TERM_B", "TERM_C" ], options); + // + // var options = new c.VocabularyDeletionOptions(); + // options.setReason("test reason"); + // facade.deleteVocabularies([ "VOCAB" ], options); }).fail(function(error) { c.fail("Error searching vocabularies. error=" + error.message); }); -- GitLab