Skip to content

Commit f174f0a

Browse files
committed
update unittests
1 parent c1a66e1 commit f174f0a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/app/features/registries/components/files-control/files-control.component.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,19 @@ describe('FilesControlComponent', () => {
228228
expect(store.dispatch).not.toHaveBeenCalledWith(expect.any(SetFilesIsLoading));
229229
expect(store.dispatch).not.toHaveBeenCalledWith(expect.any(GetFiles));
230230
});
231+
232+
it('should delete entry, show success toast, refresh files, and emit removal', () => {
233+
const file = { id: 'file-1', links: { delete: '/delete-link' } } as FileModel;
234+
const deleteSpy = vi.spyOn(component['actions'], 'deleteDraftRegistrationFiles').mockReturnValue(of(void 0));
235+
const refreshSpy = vi.spyOn(component as any, 'refreshFilesList');
236+
const emitSpy = vi.spyOn(component.removeFromAttachedFiles, 'emit');
237+
const toastSpy = vi.spyOn(toastService, 'showSuccess');
238+
239+
component.deleteEntry(file);
240+
241+
expect(deleteSpy).toHaveBeenCalledWith('/delete-link');
242+
expect(toastSpy).toHaveBeenCalledWith('files.dialogs.deleteFile.success');
243+
expect(refreshSpy).toHaveBeenCalled();
244+
expect(emitSpy).toHaveBeenCalledWith('file-1');
245+
});
231246
});

0 commit comments

Comments
 (0)