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

Passing some tests for partial attachments

parent bb0d34a1
No related merge requests found
...@@ -471,7 +471,10 @@ describe("Create catalogs with some or none of the data payloads", () => { ...@@ -471,7 +471,10 @@ describe("Create catalogs with some or none of the data payloads", () => {
var mdp, dp; var mdp, dp;
before(async () => { // do this with beforeEach because we need to reset modifications
// to the access and selection flags
beforeEach(async () => {
mdp = await fs.readJson('./test_data/datapub.json'); mdp = await fs.readJson('./test_data/datapub.json');
dp = mdp['metadata']; dp = mdp['metadata'];
}); });
...@@ -489,7 +492,7 @@ describe("Create catalogs with some or none of the data payloads", () => { ...@@ -489,7 +492,7 @@ describe("Create catalogs with some or none of the data payloads", () => {
it("can create a catalog with one payload file deselected", async () => { it("can create a catalog with one payload file deselected", async () => {
dp['dataLocations'][0]['selected'] = false; dp['dataLocations'][0]['selected'] = false;
dp['accessRightsToggle'] = true; //dp['accessRightsToggle'] = true;
var selected = []; var selected = [];
dp['dataLocations'].forEach((l) => { dp['dataLocations'].forEach((l) => {
//files[l['name']] = l['selected']; //files[l['name']] = l['selected'];
...@@ -499,9 +502,12 @@ describe("Create catalogs with some or none of the data payloads", () => { ...@@ -499,9 +502,12 @@ describe("Create catalogs with some or none of the data payloads", () => {
}); });
const cj = await make_catalog(dp); const cj = await make_catalog(dp);
await fs.writeJson('./test_data/CATALOG_deselected.json', cj, { 'spaces': 4 });
await fs.writeJson('./test_data/datapub_deselected.json', dp, { 'spaces': 4 });
const root = get_root(cj); const root = get_root(cj);
const parts = root['hasPart']; const parts = root['hasPart'];
expect(parts).to.equal(selected.map((f) => { return { '@id': f }})); expect(parts).to.deep.equal(selected.map((f) => { return { '@id': f }}));
//const files = get_type(cj, '@file'); //const files = get_type(cj, '@file');
//expect(files).to.be.empty; //expect(files).to.be.empty;
}); });
......
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