diff --git a/frontend/src/app/components/manage-units-dialog/manage-units-dialog.component.spec.ts b/frontend/src/app/components/manage-units-dialog/manage-units-dialog.component.spec.ts index 3b2791b3a0..0ba6f52435 100644 --- a/frontend/src/app/components/manage-units-dialog/manage-units-dialog.component.spec.ts +++ b/frontend/src/app/components/manage-units-dialog/manage-units-dialog.component.spec.ts @@ -171,6 +171,9 @@ describe('ManageUnitsDialogComponent', () => { (component.fg.get('unitFormArray') as FormArray)?.clear(); mockItems.forEach((item) => addNewItem(item)); + jest.spyOn(component, 'getChangedItems') + .mockReturnValue(mockItems); + const updateUnitSpy = jest.spyOn(unitServiceMock, 'updateUnit'); updateUnitSpy.mockReset(); const createUnitSpy = jest.spyOn(unitServiceMock, 'createUnit'); diff --git a/frontend/src/app/components/manage-units-dialog/manage-units-dialog.component.ts b/frontend/src/app/components/manage-units-dialog/manage-units-dialog.component.ts index cfbfea5802..f668f2ee65 100644 --- a/frontend/src/app/components/manage-units-dialog/manage-units-dialog.component.ts +++ b/frontend/src/app/components/manage-units-dialog/manage-units-dialog.component.ts @@ -25,7 +25,7 @@ export class ManageUnitsDialogComponent implements OnInit { constructor(private unitService: UnitService, private dialogRef: MatDialogRef, private unitPipe: UnitTransformationPipe) { } - private getChangedItems() { + getChangedItems() { const itemControls = (this.fg.get('unitFormArray') as FormArray)?.controls as FormGroup>[]; return itemControls.filter((c) => c.dirty) .map((c) => c.getRawValue() as Item);