mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
11e58b5844
* Uncouple account-upgrade and exposted-settings from Angular * Mock socket shim with the correct methods * Extract timeout upgrade prompt to a component GitOrigin-RevId: ee8058b38bf5e20924a21f40d32c5bb0ee06c555
31 lines
814 B
JavaScript
31 lines
814 B
JavaScript
import React from 'react'
|
|
import { render } from '@testing-library/react'
|
|
import { ApplicationProvider } from '../../../frontend/js/shared/context/application-context'
|
|
import { EditorProvider } from '../../../frontend/js/shared/context/editor-context'
|
|
import sinon from 'sinon'
|
|
|
|
export function renderWithEditorContext(
|
|
children,
|
|
{ user = { id: '123abd' }, projectId } = {}
|
|
) {
|
|
window.user = user || window.user
|
|
window.project_id = projectId != null ? projectId : window.project_id
|
|
window._ide = {
|
|
$scope: {
|
|
project: {
|
|
owner: {
|
|
_id: '124abd'
|
|
}
|
|
}
|
|
},
|
|
socket: {
|
|
on: sinon.stub(),
|
|
removeListener: sinon.stub()
|
|
}
|
|
}
|
|
return render(
|
|
<ApplicationProvider>
|
|
<EditorProvider>{children}</EditorProvider>
|
|
</ApplicationProvider>
|
|
)
|
|
}
|