mock-scope.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import { docId, mockDoc } from './mock-doc'
  2. import { Folder } from '../../../../../types/folder'
  3. import { sleep } from '../../../helpers/sleep'
  4. export const rootFolderId = '012345678901234567890123'
  5. export const figuresFolderId = '123456789012345678901234'
  6. export const figureId = '234567890123456789012345'
  7. export const mockScope = (content?: string) => {
  8. return {
  9. rootFolder: {
  10. id: rootFolderId,
  11. name: 'rootFolder',
  12. selected: false,
  13. children: [
  14. {
  15. id: docId,
  16. name: 'test.tex',
  17. selected: false,
  18. type: 'doc',
  19. },
  20. {
  21. id: figuresFolderId,
  22. name: 'figures',
  23. selected: false,
  24. type: 'folder',
  25. children: [
  26. {
  27. id: figureId,
  28. name: 'frog.jpg',
  29. selected: false,
  30. type: 'file',
  31. },
  32. {
  33. id: 'fake-figure-id',
  34. name: 'unicorn.png',
  35. selected: false,
  36. type: 'file',
  37. },
  38. ],
  39. },
  40. ],
  41. },
  42. settings: {
  43. fontSize: 12,
  44. fontFamily: 'monaco',
  45. lineHeight: 'normal',
  46. editorTheme: 'textmate',
  47. overallTheme: '',
  48. mode: 'default',
  49. autoComplete: true,
  50. autoPairDelimiters: true,
  51. trackChanges: true,
  52. syntaxValidation: false,
  53. },
  54. editor: {
  55. sharejs_doc: mockDoc(content),
  56. open_doc_name: 'test.tex',
  57. open_doc_id: docId,
  58. showVisual: false,
  59. wantTrackChanges: false,
  60. },
  61. pdf: {
  62. logEntryAnnotations: {},
  63. },
  64. project: {
  65. _id: 'test-project',
  66. name: 'Test Project',
  67. spellCheckLanguage: 'en',
  68. rootFolder: [] as Folder[],
  69. features: {
  70. trackChanges: true,
  71. },
  72. },
  73. permissions: {
  74. comment: true,
  75. write: true,
  76. },
  77. reviewPanel: {
  78. subView: 'cur_file',
  79. formattedProjectMembers: {},
  80. fullTCStateCollapsed: true,
  81. entries: {},
  82. resolvedComments: {},
  83. },
  84. ui: {
  85. reviewPanelOpen: true,
  86. },
  87. toggleReviewPanel: cy.stub(),
  88. toggleTrackChangesForEveryone: cy.stub(),
  89. refreshResolvedCommentsDropdown: cy.stub(() => sleep(1000)),
  90. onlineUserCursorHighlights: {},
  91. permissionsLevel: 'owner',
  92. $on: cy.stub().log(false),
  93. $broadcast: cy.stub().log(false),
  94. $emit: cy.stub().log(false),
  95. $root: {
  96. _references: {
  97. keys: ['foo'],
  98. },
  99. },
  100. }
  101. }