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

Test for catalog with no payload files at all if the metadata-only flag is

selected - passing
parent ef43fee7
Branches
Tags
No related merge requests found
......@@ -344,11 +344,13 @@ function make_history(dataset, people, owner, approver, dates) {
// are in the root
function make_files(datapub) {
if( !datapub['dataLocations'] ) {
// note: if accessRightsToggle is true, the publication is metadata-only
// this sucks and has been flagged for fixing
if( !datapub['dataLocations'] || datapub['accessRightsToggle'] ) {
return [];
}
const files = datapub['dataLocations'].map((dl) => {
if( dl['type'] == 'attachment' ) {
if( dl['type'] == 'attachment' && dl['selected'] ) {
return {
'@id': dl['name'],
'name': dl['name'],
......
......@@ -467,7 +467,7 @@ describe("Convert a ReDBox 2.0 DataPub to CATALOG.json", () => {
describe("Select some", () => {
describe("Create catalogs with some or none of the data payloads", () => {
var mdp, dp;
......@@ -476,12 +476,11 @@ describe("Select some", () => {
dp = mdp['metadata'];
});
it("can create a catalog with metadata-only publication", async () => {
it("can create a catalog with no payload if the metadata-only flag is true", async () => {
dp['accessRightsToggle'] = true;
const cj = await make_catalog(dp);
const root = get_root(cj);
const parts = root['hasPart'];
console.log(JSON.stringify(parts));
expect(parts).to.be.empty;
const files = get_type(cj, '@file');
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