context.js 634 B

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