mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
577497b655
[misc] add readonly mirror of full project content on the client GitOrigin-RevId: 940bd93bfd587f83ca383d10fc44579b38fc3e88
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
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'
|
|
|
|
describe('<FileViewText/>', function () {
|
|
const file = {
|
|
id: '123',
|
|
hash: '1234',
|
|
name: 'example.tex',
|
|
linkedFileData: {
|
|
v1_source_doc_id: 'v1-source-id',
|
|
source_project_id: 'source-project-id',
|
|
source_entity_path: '/source-entity-path.ext',
|
|
provider: 'project_file',
|
|
},
|
|
created: new Date(2021, 1, 17, 3, 24).toISOString(),
|
|
}
|
|
|
|
beforeEach(function () {
|
|
fetchMock.reset()
|
|
})
|
|
|
|
it('renders a text view', async function () {
|
|
fetchMock.head('express:/project/:project_id/file/:file_id', {
|
|
status: 201,
|
|
headers: { 'Content-Length': 10000 },
|
|
})
|
|
fetchMock.get(
|
|
'express:/project/:project_id/file/:file_id',
|
|
'Text file content'
|
|
)
|
|
|
|
renderWithEditorContext(
|
|
<FileViewText file={file} onError={() => {}} onLoad={() => {}} />
|
|
)
|
|
|
|
await screen.findByText('Text file content', { exact: false })
|
|
})
|
|
})
|