overleaf/services/web/test/frontend/features/binary-file/components/binary-file-image.test.js
Jakob Ackermann 8f0a0439cd Merge pull request #4069 from overleaf/as-file-views-use-context
Pull project id from `EditorContext` instead of `window` in file views

GitOrigin-RevId: 78c2686d8bcd1e95414631ca77143fd9ae3edbc6
2021-05-22 02:05:56 +00:00

28 lines
750 B
JavaScript

import React from 'react'
import { screen } from '@testing-library/react'
import { renderWithEditorContext } from '../../../helpers/render-with-context'
import BinaryFileImage from '../../../../../frontend/js/features/binary-file/components/binary-file-image.js'
describe('<BinaryFileImage />', function () {
const file = {
id: '60097ca20454610027c442a8',
name: 'file.jpg',
linkedFileData: {
source_entity_path: '/source-entity-path',
provider: 'project_file',
},
}
it('renders an image', function () {
renderWithEditorContext(
<BinaryFileImage
fileName={file.name}
fileId={file.id}
onError={() => {}}
onLoad={() => {}}
/>
)
screen.getByRole('img')
})
})