mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-24 01:06:17 +00:00
Chore: add tests for previewText handling in DocumentDetail
This commit is contained in:
@@ -1388,4 +1388,19 @@ describe('DocumentDetailComponent', () => {
|
|||||||
component.openEmailDocument()
|
component.openEmailDocument()
|
||||||
expect(modalSpy).toHaveBeenCalled()
|
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')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user