Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
3cc218f4
Commit
3cc218f4
authored
1 year ago
by
vkovtun
Browse files
Options
Downloads
Patches
Plain Diff
BIS-772: Fixing JS tests.
parent
9a4e239e
No related branches found
No related tags found
1 merge request
!40
SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-import-export.js
+60
-56
60 additions, 56 deletions
...bapps/openbis-v3-api-test/html/test/test-import-export.js
with
60 additions
and
56 deletions
test-api-openbis-javascript/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-import-export.js
+
60
−
56
View file @
3cc218f4
...
@@ -98,59 +98,59 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
...
@@ -98,59 +98,59 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
});
});
}
}
//
QUnit.test("executeImport()", function(assert) {
QUnit
.
test
(
"
executeImport()
"
,
function
(
assert
)
{
//
var c = new common(assert, dtos);
var
c
=
new
common
(
assert
,
dtos
);
//
//
var fAction = function(facade) {
var
fAction
=
function
(
facade
)
{
//
var importData = new dtos.UncompressedImportData();
var
importData
=
new
dtos
.
UncompressedImportData
();
//
importData.setFormat("XLS");
importData
.
setFormat
(
"
XLS
"
);
//
importData.setFile(fileContent);
importData
.
setFile
(
fileContent
);
//
//
var importOptions = new dtos.ImportOptions();
var
importOptions
=
new
dtos
.
ImportOptions
();
//
importOptions.setMode("UPDATE_IF_EXISTS");
importOptions
.
setMode
(
"
UPDATE_IF_EXISTS
"
);
//
//
return facade.executeImport(importData, importOptions);
return
facade
.
executeImport
(
importData
,
importOptions
);
//
}
}
//
//
var fCheck = function(facade) {
var
fCheck
=
function
(
facade
)
{
//
var criteria = new dtos.VocabularySearchCriteria();
var
criteria
=
new
dtos
.
VocabularySearchCriteria
();
//
criteria.withCode().thatEquals("VOCAB");
criteria
.
withCode
().
thatEquals
(
"
VOCAB
"
);
//
//
var vocabularyFetchOptions = c.createVocabularyFetchOptions()
var
vocabularyFetchOptions
=
c
.
createVocabularyFetchOptions
()
//
vocabularyFetchOptions.withTerms();
vocabularyFetchOptions
.
withTerms
();
//
//
return facade.searchVocabularies(criteria, vocabularyFetchOptions).then(function(results) {
return
facade
.
searchVocabularies
(
criteria
,
vocabularyFetchOptions
).
then
(
function
(
results
)
{
//
c.assertEqual(results.getTotalCount(), 1)
c
.
assertEqual
(
results
.
getTotalCount
(),
1
)
//
var vocabulary = (results.getObjects())[0];
var
vocabulary
=
(
results
.
getObjects
())[
0
];
//
//
c.assertEqual(vocabulary.code, "VOCAB");
c
.
assertEqual
(
vocabulary
.
code
,
"
VOCAB
"
);
//
//
var terms = vocabulary.getTerms();
var
terms
=
vocabulary
.
getTerms
();
//
//
c.assertEqual(terms.length, 3)
c
.
assertEqual
(
terms
.
length
,
3
)
//
//
var codes = terms.map(function(object) {
var
codes
=
terms
.
map
(
function
(
object
)
{
//
return object.code;
return
object
.
code
;
//
}).sort();
}).
sort
();
//
//
var labels = terms.map(function(object) {
var
labels
=
terms
.
map
(
function
(
object
)
{
//
return object.label;
return
object
.
label
;
//
}).sort();
}).
sort
();
//
//
c.assertEqual(codes[0], "TERM_A");
c
.
assertEqual
(
codes
[
0
],
"
TERM_A
"
);
//
c.assertEqual(codes[1], "TERM_B");
c
.
assertEqual
(
codes
[
1
],
"
TERM_B
"
);
//
c.assertEqual(codes[2], "TERM_C");
c
.
assertEqual
(
codes
[
2
],
"
TERM_C
"
);
//
//
c.assertEqual(labels[0], "A");
c
.
assertEqual
(
labels
[
0
],
"
A
"
);
//
c.assertEqual(labels[1], "B");
c
.
assertEqual
(
labels
[
1
],
"
B
"
);
//
c.assertEqual(labels[2], "C");
c
.
assertEqual
(
labels
[
2
],
"
C
"
);
//
}).fail(function(error) {
}).
fail
(
function
(
error
)
{
//
c.fail("Error searching vocabularies. error=" + error.message);
c
.
fail
(
"
Error searching vocabularies. error=
"
+
error
.
message
);
//
});
});
//
}
}
//
//
testAction(c, fAction, fCheck);
testAction
(
c
,
fAction
,
fCheck
);
//
});
});
QUnit
.
test
(
"
executeExport()
"
,
function
(
assert
)
{
QUnit
.
test
(
"
executeExport()
"
,
function
(
assert
)
{
var
c
=
new
common
(
assert
,
dtos
);
var
c
=
new
common
(
assert
,
dtos
);
...
@@ -170,9 +170,13 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
...
@@ -170,9 +170,13 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
var
fCheck
=
function
(
facade
,
result
)
{
var
fCheck
=
function
(
facade
,
result
)
{
c
.
assertNotNull
(
result
);
c
.
assertNotNull
(
result
);
c
.
assertEqual
(
result
.
results
.
length
,
1
);
if
(
!
result
.
downloadURL
)
{
c
.
assertNotNull
(
result
.
results
[
0
].
exportResult
);
c
.
assertNotNull
(
result
.
results
);
c
.
assertNotNull
(
result
.
results
[
0
].
exportResult
.
downloadURL
);
c
.
assertEqual
(
result
.
results
.
length
,
1
);
c
.
assertNotNull
(
result
.
results
[
0
].
exportResult
);
c
.
assertNotNull
(
result
.
results
[
0
].
exportResult
.
downloadURL
);
}
return
null
;
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment