diff --git a/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.spec.ts b/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.spec.ts index 717d186..a96921c 100644 --- a/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.spec.ts +++ b/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.spec.ts @@ -4,6 +4,7 @@ import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from '@angular/material' import {MatFormFieldModule} from '@angular/material/form-field'; import {MatInputModule} from '@angular/material/input'; import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations'; +import createClone from 'rfdc'; import {FileType} from 'sartography-workflow-lib'; import {FileMetaDialogData} from '../../_interfaces/dialog-data'; import {FileMetaDialogComponent} from './file-meta-dialog.component'; @@ -81,7 +82,7 @@ describe('EditFileMetaDialogComponent', () => { component.data = dataBefore; component.onSubmit(); - const expectedData: FileMetaDialogData = JSON.parse(JSON.stringify(dataBefore)); + const expectedData: FileMetaDialogData = createClone()(dataBefore); expectedData.fileName = 'green_eggs.v1-2020-01-01.XML.bpmn'; expect(closeSpy).toHaveBeenCalledWith(expectedData); }); diff --git a/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts b/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts index 9f21c20..1be65e2 100644 --- a/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts +++ b/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts @@ -8,6 +8,7 @@ import {MatSnackBarModule} from '@angular/material/snack-bar'; import {BrowserDynamicTestingModule} from '@angular/platform-browser-dynamic/testing'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {RouterTestingModule} from '@angular/router/testing'; +import createClone from 'rfdc'; import {of} from 'rxjs'; import { ApiService, @@ -20,7 +21,6 @@ import {DeleteWorkflowSpecDialogComponent} from '../_dialogs/delete-workflow-spe import {DeleteWorkflowSpecDialogData, WorkflowSpecDialogData} from '../_interfaces/dialog-data'; import {GetIconCodePipe} from '../_pipes/get-icon-code.pipe'; import {FileListComponent} from '../file-list/file-list.component'; - import {WorkflowSpecListComponent} from './workflow-spec-list.component'; describe('WorkflowSpecListComponent', () => { @@ -126,7 +126,7 @@ describe('WorkflowSpecListComponent', () => { _updateWorkflowSpecSpy.calls.reset(); component.selectedSpec = mockWorkflowSpec0; - const modifiedData: WorkflowSpecDialogData = JSON.parse(JSON.stringify(mockWorkflowSpec0)); + const modifiedData: WorkflowSpecDialogData = createClone()(mockWorkflowSpec0); modifiedData.display_name = 'Modified'; (component as any)._upsertWorkflowSpecification(modifiedData); expect(_addWorkflowSpecSpy).not.toHaveBeenCalled();