Skip to content
Snippets Groups Projects
Commit 39e61171 authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-3395 : V3 AS API - controlled vocabulary terms - more js-tests for vocabularies

SVN: 36072
parent eff5e3ea
No related branches found
No related tags found
No related merge requests found
...@@ -167,6 +167,16 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, openbis, ...@@ -167,6 +167,16 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, openbis,
}); });
}.bind(this); }.bind(this);
this.createVocabularyTerm = function(facade) {
var c = this;
var creation = new dtos.VocabularyTermCreation();
creation.setCode(c.generateId("VOCABULARY_TERM"));
creation.setVocabularyId(new c.VocabularyPermId("TEST-VOCABULARY"));
return facade.createVocabularyTerms([ creation ]).then(function(permIds) {
return permIds[0];
});
}.bind(this);
this.findSpace = function(facade, id) { this.findSpace = function(facade, id) {
var c = this; var c = this;
return facade.mapSpaces([ id ], c.createSpaceFetchOptions()).then(function(spaces) { return facade.mapSpaces([ id ], c.createSpaceFetchOptions()).then(function(spaces) {
...@@ -257,6 +267,13 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, openbis, ...@@ -257,6 +267,13 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, openbis,
options.setReason("test reason"); options.setReason("test reason");
return facade.deleteMaterials([ id ], options); return facade.deleteMaterials([ id ], options);
}.bind(this); }.bind(this);
this.deleteVocabularyTerm = function(facade, id) {
var c = this;
var options = new dtos.VocabularyTermDeletionOptions();
options.setReason("test reason");
return facade.deleteVocabularyTerms([ id ], options);
}.bind(this);
this.getObjectProperty = function(object, propertyName) { this.getObjectProperty = function(object, propertyName) {
var propertyNames = propertyName.split('.'); var propertyNames = propertyName.split('.');
......
...@@ -153,6 +153,11 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open ...@@ -153,6 +153,11 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
var c = new common(assert); var c = new common(assert);
testDeleteWithoutTrash(c, c.createMaterial, c.findMaterial, c.deleteMaterial); testDeleteWithoutTrash(c, c.createMaterial, c.findMaterial, c.deleteMaterial);
}); });
QUnit.test("deleteVocabularyTerm()", function(assert) {
var c = new common(assert);
testDeleteWithoutTrash(c, c.createVocabularyTerm, c.findVocabularyTerm, c.deleteVocabularyTerm);
});
} }
}); });
...@@ -269,5 +269,29 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open ...@@ -269,5 +269,29 @@ define([ 'jquery', 'underscore', 'openbis', 'test/common' ], function($, _, open
testMap(c, fCreate, fMap, fMapEmptyFetchOptions, fechOptionsTestConfig); testMap(c, fCreate, fMap, fMapEmptyFetchOptions, fechOptionsTestConfig);
}); });
QUnit.test("mapVocabularyTerms()", function(assert) {
var c = new common(assert);
var fo = new c.VocabularyTermFetchOptions();
var fechOptionsTestConfig = getConfigForFetchOptions(fo);
fechOptionsTestConfig.SortBy = null;
var fCreate = function(facade) {
return $.when(c.createVocabularyTerm(facade), c.createVocabularyTerm(facade)).then(function(permId1, permId2) {
return [ permId1, permId2 ];
});
}
var fMap = function(facade, permIds) {
testFetchOptionsAssignation(c, fo, fechOptionsTestConfig);
return facade.mapVocabularyTerms(permIds, fo);
}
var fMapEmptyFetchOptions = function(facade, permIds) {
return facade.mapVocabularyTerms(permIds, new c.VocabularyTermFetchOptions());
}
testMap(c, fCreate, fMap, fMapEmptyFetchOptions, fechOptionsTestConfig);
});
} }
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment