Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
eResearch
CalcyteJS
Commits
994ee93b
Commit
994ee93b
authored
Dec 05, 2019
by
PTSEFTON
Browse files
Fixing tests
parent
a2fdf38b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
994ee93b
...
...
@@ -3,3 +3,4 @@ node_modules
.idea
test_data/output/
test_data/catalog/index.html
.calcyte.code-workspace
compiled/crate.js
deleted
100644 → 0
View file @
a2fdf38b
This diff is collapsed.
Click to expand it.
test/collection.spec.js
View file @
994ee93b
...
...
@@ -233,7 +233,7 @@ describe("Glop Plot data", function() {
"
Expected 5 items in
"
+
JSON
.
stringify
(
items
)
);
assert
.
equal
(
c
.
item_by_id
[
"
sketchsheets
"
][
"
hasPart
"
].
length
,
3
);
assert
.
equal
(
c
.
item_by_id
[
"
sketchsheets
/
"
][
"
hasPart
"
].
length
,
3
);
var
a_file
=
c
.
item_by_id
[
"
sketchsheets/CP7Glopsketch01.jpg
"
];
assert
.
equal
(
a_file
.
contentSize
,
"
179640
"
);
assert
.
equal
(
a_file
.
encodingFormat
,
"
JPEG File Interchange Format
"
);
...
...
test/property.spec.js
View file @
994ee93b
...
...
@@ -27,7 +27,6 @@ describe("Simple ID", function() {
f
.
parse
(
"
ID
"
,
"
https://orcid.org/something
"
);
assert
(
f
.
is_id
);
assert
.
equal
(
f
.
data
[
0
],
"
https://orcid.org/something
"
);
assert
.
equal
(
f
.
property_URI
,
"
http://schema.org/identifier
"
);
done
();
});
});
...
...
test/ro-crate-preview_spec.js
deleted
100644 → 0
View file @
a2fdf38b
/* This is part of Calcyte a tool for implementing the DataCrate data packaging
spec. Copyright (C) 2018 University of Technology Sydney
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const
assert
=
require
(
'
assert
'
);
const
fs
=
require
(
'
fs-extra
'
);
const
path
=
require
(
'
path
'
);
const
Preview
=
require
(
'
../../../working/ro-crate-js/lib/ro-crate-preview-wrapper
'
);
const
Crate
=
require
(
'
../../../working/ro-crate-js/lib/rocrate
'
)
const
cheerio
=
require
(
'
cheerio
'
);
const
chai
=
require
(
'
chai
'
);
const
expect
=
chai
.
expect
;
chai
.
use
(
require
(
'
chai-fs
'
));
console
.
log
(
Preview
);
describe
(
'
single item rendering
'
,
function
()
{
it
(
'
should create a simple table
'
,
async
function
()
{
json
=
JSON
.
parse
(
fs
.
readFileSync
(
"
test_data/sample-ro-crate-metadata.jsonld
"
));
const
preview
=
new
Preview
(
new
Crate
(
json
));
const
table
=
await
preview
.
renderMetadataForItem
(
preview
.
rootId
);
assert
.
equal
(
table
.
find
(
"
tr
"
).
length
,
17
,
"
Has the right number of rows
"
);
});
});
describe
(
'
metadata summary
'
,
function
()
{
it
(
'
should create multipe metadata tables
'
,
async
function
()
{
json
=
JSON
.
parse
(
fs
.
readFileSync
(
"
test_data/sample-ro-crate-metadata.jsonld
"
));
const
preview
=
new
Preview
(
new
Crate
(
json
));
const
div
=
await
preview
.
summarizeDataset
();
assert
.
equal
(
div
.
find
(
"
table
"
).
length
,
8
,
"
Has the right number of summary tables
"
);
});
});
describe
(
'
datacite
'
,
function
()
{
it
(
'
should create a datacite-compatible file
'
,
async
function
()
{
json
=
JSON
.
parse
(
fs
.
readFileSync
(
"
test_data/sample-ro-crate-metadata.jsonld
"
));
const
preview
=
new
Preview
(
new
Crate
(
json
));
const
cite
=
preview
.
makeDataCite
();
assert
.
equal
(
cite
[
"
@type
"
],
"
Dataset
"
,
"
Has the right number of summary tables
"
);
assert
.
equal
(
cite
.
creator
.
name
,
"
Peter Sefton
"
,
"
Name is correctly nested
"
)
assert
.
equal
(
cite
.
publisher
.
contactPoint
[
'
@id
'
],
"
peter.sefton@uts.edu.au
"
,
"
Name is correctly nested
"
)
});
});
after
(
function
()
{
//TODO: destroy test repoPath
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment