mock-scope.ts 2.4 KB

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