mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 14:00:05 +02:00

* Refactor project context to not use scope store * Fix Cypress tests for project context changes * Fix frontend React Testing Library tests for project context changes * Remove redundant code * Fix some project types in tests * Remove unused import and fix a type * Throw an error if updating the project in the project context before joining the project * Fix some review panel tests * Remove unused imports GitOrigin-RevId: 2f0c928b651f387aa980c29aef7d1ba0649790a7
78 lines
2 KiB
TypeScript
78 lines
2 KiB
TypeScript
import { docId } from './mock-doc'
|
|
import { Folder } from '../../../../../types/folder'
|
|
import { UserId } from '../../../../../types/user'
|
|
import { ProjectCompiler } from '../../../../../types/project-settings'
|
|
|
|
export const rootFolderId = '012345678901234567890123'
|
|
export const figuresFolderId = '123456789012345678901234'
|
|
export const figureId = '234567890123456789012345'
|
|
export const mockProject = ({
|
|
projectFeatures = {},
|
|
projectOwner = undefined,
|
|
spellCheckLanguage = 'en',
|
|
rootFolder = null,
|
|
}: any = {}) => {
|
|
return {
|
|
_id: 'test-project',
|
|
name: 'Test Project',
|
|
spellCheckLanguage,
|
|
rootDocId: '_root_doc_id',
|
|
rootFolder:
|
|
rootFolder ||
|
|
([
|
|
{
|
|
_id: rootFolderId,
|
|
name: 'rootFolder',
|
|
docs: [
|
|
{
|
|
_id: docId,
|
|
name: 'test.tex',
|
|
},
|
|
],
|
|
folders: [
|
|
{
|
|
_id: figuresFolderId,
|
|
name: 'figures',
|
|
docs: [
|
|
{
|
|
_id: 'fake-nested-doc-id',
|
|
name: 'foo.tex',
|
|
},
|
|
],
|
|
folders: [],
|
|
fileRefs: [
|
|
{
|
|
_id: figureId,
|
|
name: 'frog.jpg',
|
|
hash: '42',
|
|
},
|
|
{
|
|
_id: 'fake-figure-id',
|
|
name: 'unicorn.png',
|
|
hash: '43',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
fileRefs: [],
|
|
},
|
|
] as Folder[]),
|
|
features: {
|
|
trackChanges: true,
|
|
...projectFeatures,
|
|
},
|
|
compiler: 'pdflatex' as ProjectCompiler,
|
|
imageName: 'texlive-full:2024.1',
|
|
trackChangesState: false,
|
|
invites: [],
|
|
members: [],
|
|
owner: projectOwner || {
|
|
_id: '124abd' as UserId,
|
|
email: 'owner@example.com',
|
|
first_name: 'Test',
|
|
last_name: 'Owner',
|
|
privileges: 'owner',
|
|
signUpDate: new Date('2025-07-07').toISOString(),
|
|
},
|
|
}
|
|
}
|