Files
Verso/services/web/test/frontend/features/file-view/components/file-view-text.test.tsx
T
DavidandCopybot 9e6db89311 Merge pull request #27811 from overleaf/dp-file-view-typescript
Convert file-view components and test files to typescript

GitOrigin-RevId: 277aa8fd4f3d06a322dc9d0b372eebefb26fd285
2025-08-14 08:05:43 +00:00

31 lines
961 B
TypeScript

import { screen } from '@testing-library/react'
import fetchMock from 'fetch-mock'
import { renderWithEditorContext } from '../../../helpers/render-with-context'
import FileViewText from '../../../../../frontend/js/features/file-view/components/file-view-text'
import { textFile } from '../util/files'
describe('<FileViewText/>', function () {
beforeEach(function () {
fetchMock.removeRoutes().clearHistory()
window.metaAttributesCache.set('ol-preventCompileOnLoad', true)
})
it('renders a text view', async function () {
fetchMock.head('express:/project/:project_id/blob/:hash', {
status: 201,
headers: { 'Content-Length': 10000 },
})
fetchMock.get(
'express:/project/:project_id/blob/:hash',
'Text file content'
)
renderWithEditorContext(
<FileViewText file={textFile} onError={() => {}} onLoad={() => {}} />
)
await screen.findByText('Text file content', { exact: false })
})
})