overleaf/services/web/test/frontend/features/file-tree/helpers/render-with-context.js
Timothée Alby 420aa4a657 Merge pull request #3232 from overleaf/ta-file-tree-react
React File Tree

GitOrigin-RevId: fb3141ba8cd9ca0d68e87edb74764a360144c8fe
2020-11-27 03:05:05 +00:00

18 lines
536 B
JavaScript

import React from 'react'
import { render } from '@testing-library/react'
import FileTreeContext from '../../../../../frontend/js/features/file-tree/components/file-tree-context'
export default (children, options = {}) => {
let { contextProps = {}, ...renderOptions } = options
contextProps = {
projectId: '123abc',
rootFolder: [{}],
hasWritePermissions: true,
onSelect: () => {},
...contextProps
}
return render(
<FileTreeContext {...contextProps}>{children}</FileTreeContext>,
renderOptions
)
}