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

Started to flesh out the tests

parent 1ba7d95e
No related merge requests found
...@@ -39,9 +39,20 @@ const APPROVER = 'data.librarian@uts.edu.au'; ...@@ -39,9 +39,20 @@ const APPROVER = 'data.librarian@uts.edu.au';
const DATASET_ID = 'DATASET_ID'; const DATASET_ID = 'DATASET_ID';
function graph_get(graph, id) {
const match = graph.filter((item) => item['@id'] === id);
if( match.length ) {
return match[0];
} else {
return null;
}
}
describe("ReDBox data publication to DataCrate catalog.json", () => { describe("ReDBox data publication to DataCrate catalog.json", () => {
it("Can run at all ", async () => { it("returns a catalog with a dataset item", async () => {
const dp = await fs.readJson('./test_data/datapub.json'); const dp = await fs.readJson('./test_data/datapub.json');
const cj = await catalog.datapub2catalog({ const cj = await catalog.datapub2catalog({
'id': DATASET_ID, 'id': DATASET_ID,
...@@ -50,10 +61,18 @@ describe("ReDBox data publication to DataCrate catalog.json", () => { ...@@ -50,10 +61,18 @@ describe("ReDBox data publication to DataCrate catalog.json", () => {
'owner': OWNER, 'owner': OWNER,
'approver': APPROVER 'approver': APPROVER
}); });
console.log(JSON.stringify(cj['@graph'], null, 2)); assert(cj, "Got an object");
assert(cj, "Got something back") assert(cj['@graph'], "Catalog has a @graph");
const dataset = graph_get(cj['@graph'], DATASET_ID);
assert(dataset, "Graph has an item with id " + DATASET_ID);
expect(dataset['name']).to.equal(dp['title']);
expect(dataset['description']).to.equal(dp['description']);
}); });
it("Can set dateCreated and datePublished", async() => {
assert(true);
})
}); });
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