From 46faa2996dd418a0027cb439a992184e09d068a0 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 4 Nov 2023 21:40:17 -0700 Subject: [PATCH] Add coverage for refresh fields on create --- .../document-detail/document-detail.component.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts index c0f1e44b7..9f49e737b 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts @@ -896,6 +896,15 @@ describe('DocumentDetailComponent', () => { expect(component.getCustomFieldError(4)).toEqual(['Enter a valid URL.']) }) + it('should refresh custom fields when created', () => { + initNormally() + const refreshSpy = jest.spyOn(component, 'refreshCustomFields') + fixture.debugElement + .query(By.directive(CustomFieldsDropdownComponent)) + .triggerEventHandler('created') + expect(refreshSpy).toHaveBeenCalled() + }) + function initNormally() { jest .spyOn(documentService, 'get')