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

Funders test written and passing

parent 0aa39585
Branches
No related merge requests found
......@@ -191,6 +191,35 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
})
});
// funders is different from subjects because we are putting all
// funders under the same prefix, which might be a mistake
it("has funders", () => {
const fields = [ 'foaf:fundedBy_foaf:Agent', 'foaf:fundedBy_vivo:Grant' ];
const funderids = cjds['funder'].map((i) => i['@id']);
const pref = IRI_PREFIXES['funder'];
var expectfunders = [];
fields.map((field) => {
if( dp[field] && dp[field].length > 0 ) {
expectfunders.push(...dp[field]);
}
});
const expectnames = expectfunders.map((f) => f['dc_title']);
const gotfunders = get_id_prefix(cj, pref);
const gotnames = gotfunders.map((f) => f['name']);
if( expectfunders.length > 0 ) {
expect(gotnames.sort()).to.eql(expectnames.sort());
} else {
expect(gotfunders).to.be.empty;
}
gotfunders.map((s) => assert_link('funder', s));
});
// geolocations - basic_name / latitude / longitude
// this test assumes that each geolocation's name is unique in the
......@@ -220,6 +249,7 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
it("has temporal coverage", () => {
var tc = '';
if( dp['startDate'] ) {
......@@ -246,10 +276,6 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
}
});
it("has funders", () => {
assert(false, "Not written yet");
});
it("has a licence", () => {
const licenses = cjds['license'];
if( dp['license_other_url'] || dp['license_identifier'] ) {
......@@ -266,12 +292,12 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
expect(litem['name']).to.equal(dp['license_statement']);
expect(litem['url]']).to.equal(dp['license_statement_url']);
}
assert_link('license', litem)
assert_link('license', litem);
}
});
it("has related works", () => {
assert(false, "Not written yet");
});
......
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