Uses rfdc for cloning objects
This commit is contained in:
parent
d43dc499c5
commit
e20041a29f
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue