2020-11-26 09:22:30 -05:00
|
|
|
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',
|
2021-03-18 05:52:36 -04:00
|
|
|
rootFolder: [
|
|
|
|
{
|
|
|
|
docs: [],
|
|
|
|
fileRefs: [],
|
2021-04-27 03:52:58 -04:00
|
|
|
folders: [],
|
|
|
|
},
|
2021-03-18 05:52:36 -04:00
|
|
|
],
|
2020-11-26 09:22:30 -05:00
|
|
|
hasWritePermissions: true,
|
2021-03-24 06:06:56 -04:00
|
|
|
userHasFeature: () => true,
|
2021-03-18 05:52:36 -04:00
|
|
|
refProviders: {},
|
|
|
|
reindexReferences: () => {
|
|
|
|
console.log('reindex references')
|
|
|
|
},
|
|
|
|
setRefProviderEnabled: provider => {
|
|
|
|
console.log(`ref provider ${provider} enabled`)
|
|
|
|
},
|
|
|
|
setStartedFreeTrial: () => {
|
|
|
|
console.log('started free trial')
|
|
|
|
},
|
2020-11-26 09:22:30 -05:00
|
|
|
onSelect: () => {},
|
2021-04-27 03:52:58 -04:00
|
|
|
...contextProps,
|
2020-11-26 09:22:30 -05:00
|
|
|
}
|
|
|
|
return render(
|
|
|
|
<FileTreeContext {...contextProps}>{children}</FileTreeContext>,
|
|
|
|
renderOptions
|
|
|
|
)
|
|
|
|
}
|