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

Test for deselecting a file is passing

parent 78311068
Branches
Tags
No related merge requests found
......@@ -492,24 +492,21 @@ describe("Create catalogs with some or none of the data payloads", () => {
it("can create a catalog with one payload file deselected", async () => {
dp['dataLocations'][0]['selected'] = false;
//dp['accessRightsToggle'] = true;
var selected = [];
dp['dataLocations'].forEach((l) => {
//files[l['name']] = l['selected'];
if( l['selected'] ) {
selected.push(l['name']);
}
});
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 parts = root['hasPart'];
expect(parts).to.deep.equal(selected.map((f) => { return { '@id': f }}));
//const files = get_type(cj, '@file');
//expect(files).to.be.empty;
const files = get_type(cj, 'File');
expect(files.length).to.equal(1);
expect(files[0]['@id']).to.equal(selected[0]);
});
......
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