From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 23 Aug 2025 03:03:06 +0000 (-0700) Subject: Chore: add test for navigation on document load error X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=HEAD;p=thirdparty%2Fpaperless-ngx.git Chore: add test for navigation on document load error --- 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'