New import export json action test (#4225)

Co-authored-by: Henry Hsu <henry.hsu@nasa.gov>
Co-authored-by: Nikhil <nikhil.k.mandlik@nasa.gov>
Co-authored-by: Jamie V <jamie.j.vigliotta@nasa.gov>
Co-authored-by: charlesh88 <charles.f.hacskaylo@nasa.gov>
Co-authored-by: Andrew Henry <akhenry@gmail.com>
Co-authored-by: John Hill <john.c.hill@nasa.gov>
Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com>
This commit is contained in:
Henry Hsu
2021-12-27 12:29:57 -08:00
committed by GitHub
parent d84808aa68
commit 6f9241c0b1
5 changed files with 309 additions and 256 deletions

View File

@@ -22,7 +22,6 @@
import JSONExporter from '/src/exporters/JSONExporter.js';
import _ from 'lodash';
import { saveAs } from 'saveAs';
import uuid from "uuid";
export default class ExportAsJSONAction {
@@ -41,7 +40,7 @@ export default class ExportAsJSONAction {
this.calls = 0;
this.idMap = {};
this.JSONExportService = new JSONExporter(saveAs);
this.JSONExportService = new JSONExporter();
}
// Public
@@ -68,7 +67,6 @@ export default class ExportAsJSONAction {
this._write(this.root);
}
/**
* @private
* @param {object} domainObject
@@ -116,6 +114,7 @@ export default class ExportAsJSONAction {
return _.isEqual(child.identifier, id);
});
const copyOfChild = JSON.parse(JSON.stringify(child));
copyOfChild.identifier.key = uuid();
const newIdString = this._getId(copyOfChild);
const parentId = this._getId(parent);