context.js 667 B

1234567891011121314151617181920212223242526272829303132
  1. import sinon from 'sinon'
  2. export function setupContext() {
  3. window.project_id = '1234'
  4. window.user = {
  5. id: 'fake_user',
  6. allowedFreeTrial: true,
  7. }
  8. let $scope = {}
  9. if (window._ide) {
  10. $scope = {
  11. ...window._ide.$scope,
  12. project: {},
  13. $watch: () => {},
  14. ui: {
  15. chatOpen: true,
  16. pdfLayout: 'flat',
  17. },
  18. }
  19. }
  20. window._ide = {
  21. ...window._ide,
  22. $scope,
  23. socket: {
  24. on: sinon.stub(),
  25. removeListener: sinon.stub(),
  26. },
  27. }
  28. window.ExposedSettings = window.ExposedSettings || {}
  29. window.ExposedSettings.appName = 'Overleaf'
  30. window.gitBridgePublicBaseUrl = 'https://git.stories.com'
  31. }