Skip to content

Commit

Permalink
fix jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Jan 30, 2025
1 parent 83bec09 commit d90157d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class ManageUnitsDialogComponent implements OnInit {
constructor(private unitService: UnitService, private dialogRef: MatDialogRef<ManageUnitsDialogComponent>, private unitPipe: UnitTransformationPipe) {
}

private getChangedItems() {
getChangedItems() {
const itemControls = (this.fg.get('unitFormArray') as FormArray)?.controls as FormGroup<FormControlsOf<Item>>[];
return itemControls.filter((c) => c.dirty)
.map((c) => c.getRawValue() as Item);
Expand Down

0 comments on commit d90157d

Please sign in to comment.