Skip to content
Snippets Groups Projects
Commit 7687e053 authored by Mike Lynch's avatar Mike Lynch
Browse files

Refactored prefix code passing tests and test for temporalCoverage complete

and passing
parent 64730b98
Branches
Tags
No related merge requests found
......@@ -462,7 +462,7 @@ function make_temporal(datapub) {
if( datapub['startDate'] ) {
tc = datapub['startDate'];
if( datapub['endDate'] ) {
tc = '/' + datapub['endDate'];
tc += '/' + datapub['endDate'];
}
} else if ( datapub['endDate'] ) {
tc = datapub['endDate'];
......
......@@ -88,7 +88,6 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
it("has string @id values for every graph item", () => {
cj['@graph'].map((i) => {
console.log("graph items @id: " + JSON.stringify(i['@id']));
expect(i).to.have.property('@id');
expect(i['@id']).to.be.a('string');
})
......@@ -129,14 +128,6 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
expect(fids).to.eql(dlids);
});
// const DATASET_PROPERTIES = {
// 'about': make_subjects,
// 'spatialCoverage': make_spatial,
// 'temporalCoverate': make_temporal,
// 'funder': make_funders,
// 'licence': make_licence,
// 'citation': make_related_works
// };
it("has subjects", () => {
// FORs and SEOs
......@@ -160,7 +151,29 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
});
it("has temporal coverage", () => {
var tc = '';
if( dp['startDate'] ) {
tc = dp['startDate'];
if( dp['endDate'] ) {
tc += '/' + dp['endDate'];
}
} else {
if( dp['endDate']) {
tc = dp['endDate'];
}
}
if( dp['timePeriod'] ) {
if( tc ) {
tc += '; ' + dp['timePeriod'];
} else {
tc = dp['timePeriod'];
}
}
if( tc ) {
expect(cjds['temporalCoverage']).to.equal(tc)
} else {
expect(cjds).not.to.have.property('temporalCoverage');
}
});
it("has funders", () => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment