| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import sinon from 'sinon'
- export function setupContext() {
- window.project_id = '1234'
- window.user = {
- id: 'fake_user',
- allowedFreeTrial: true,
- }
- const $scope = {
- ...window._ide?.$scope,
- user: window.user,
- project: {
- _id: window.project_id,
- name: 'Project Fake Name',
- features: {},
- rootFolder: [
- {
- _id: 'root-folder-id',
- name: 'rootFolder',
- docs: [],
- folders: [],
- fileRefs: [],
- },
- ],
- },
- $watch: () => {},
- $applyAsync: () => {},
- $broadcast: () => {},
- ui: {
- chatOpen: true,
- pdfLayout: 'flat',
- },
- settings: {
- pdfViewer: 'js',
- },
- toggleHistory: () => {},
- }
- window._ide = {
- ...window._ide,
- $scope,
- socket: {
- on: sinon.stub(),
- removeListener: sinon.stub(),
- },
- fileTreeManager: {
- findEntityById: () => null,
- findEntityByPath: () => null,
- getEntityPath: () => null,
- getRootDocDirname: () => undefined,
- },
- editorManager: {
- getCurrentDocId: () => 'foo',
- openDoc: (id, options) => {
- console.log('open doc', id, options)
- },
- },
- metadataManager: {
- metadata: {
- state: {
- documents: {},
- },
- },
- },
- }
- window.ExposedSettings = window.ExposedSettings || {}
- window.ExposedSettings.appName = 'Overleaf'
- window.gitBridgePublicBaseUrl = 'https://git.stories.com'
- window.metaAttributesCache = window.metaAttributesCache || new Map()
- window.metaAttributesCache.set('ol-user', window.user)
- }
|