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 748150959..d9c4e64db 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 @@ -1388,4 +1388,19 @@ describe('DocumentDetailComponent', () => { component.openEmailDocument() expect(modalSpy).toHaveBeenCalled() }) + + it('should set previewText', () => { + initNormally() + const previewText = 'Hello world, this is a test' + httpTestingController.expectOne(component.previewUrl).flush(previewText) + expect(component.previewText).toEqual(previewText) + }) + + it('should set previewText to error message if preview fails', () => { + initNormally() + httpTestingController + .expectOne(component.previewUrl) + .flush('fail', { status: 500, statusText: 'Server Error' }) + expect(component.previewText).toContain('An error occurred loading content') + }) })