From 22064ed0043bcc9b6b593da427ac6ce325c52e7f Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 22 Aug 2025 20:03:06 -0700 Subject: [PATCH] Chore: add test for navigation on document load error --- .../document-detail.component.spec.ts | 12 ++++++++++++ 1 file changed, 12 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 d9c4e64db..ed0d2a125 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 @@ -452,6 +452,18 @@ describe('DocumentDetailComponent', () => { expect(navigateSpy).toHaveBeenCalledWith(['404'], { replaceUrl: true }) }) + it('should navigate to 404 if error on load', () => { + jest + .spyOn(activatedRoute, 'paramMap', 'get') + .mockReturnValue(of(convertToParamMap({ id: 3, section: 'details' }))) + const navigateSpy = jest.spyOn(router, 'navigate') + jest + .spyOn(documentService, 'get') + .mockReturnValue(throwError(() => new Error('not found'))) + fixture.detectChanges() + expect(navigateSpy).toHaveBeenCalledWith(['404'], { replaceUrl: true }) + }) + it('should support save, close and show success toast', () => { initNormally() component.title = 'Foo Bar' -- 2.47.2