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