From 477c2a3ecd3e3470f02b9359838b42a00485542c Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Thu, 26 May 2022 10:30:37 +0100 Subject: [PATCH] Add scope-dependent autocompletion to Cypress CM6 tests (#8109) GitOrigin-RevId: 696abc40ac51ef10508db427707b5c332df326a1 --- .../test/frontend/helpers/editor-providers.js | 15 +++++++-------- services/web/types/doc.ts | 4 ++++ services/web/types/fileref.ts | 4 ++++ services/web/types/folder.ts | 9 ++++++--- services/web/types/metadata.ts | 18 ++++++++++++++++++ 5 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 services/web/types/doc.ts create mode 100644 services/web/types/fileref.ts create mode 100644 services/web/types/metadata.ts diff --git a/services/web/test/frontend/helpers/editor-providers.js b/services/web/test/frontend/helpers/editor-providers.js index c81c921d3b..9798dbe8d3 100644 --- a/services/web/test/frontend/helpers/editor-providers.js +++ b/services/web/test/frontend/helpers/editor-providers.js @@ -55,6 +55,13 @@ export function EditorProviders({ getCurrentDocValue: () => {}, openDoc: sinon.stub(), }, + metadataManager = { + metadata: { + state: { + documents: {}, + }, + }, + }, }) { window.user = user || window.user window.gitBridgePublicBaseUrl = 'git.overleaf.test' @@ -86,14 +93,6 @@ export function EditorProviders({ ...scope, } - const metadataManager = { - metadata: { - state: { - documents: {}, - }, - }, - } - window._ide = { $scope, socket, diff --git a/services/web/types/doc.ts b/services/web/types/doc.ts new file mode 100644 index 0000000000..ee2bcac004 --- /dev/null +++ b/services/web/types/doc.ts @@ -0,0 +1,4 @@ +export type Doc = { + _id: string + name: string +} diff --git a/services/web/types/fileref.ts b/services/web/types/fileref.ts new file mode 100644 index 0000000000..80fd2bbeab --- /dev/null +++ b/services/web/types/fileref.ts @@ -0,0 +1,4 @@ +export type FileRef = { + _id: string + name: string +} diff --git a/services/web/types/folder.ts b/services/web/types/folder.ts index ee12a87a55..34c64c35aa 100644 --- a/services/web/types/folder.ts +++ b/services/web/types/folder.ts @@ -1,7 +1,10 @@ +import { Doc } from './doc' +import { FileRef } from './fileref' + export type Folder = { _id: string name: string - docs: [] - folders: [] - fileRefs: [] + docs: Doc[] + folders: Folder[] + fileRefs: FileRef[] } diff --git a/services/web/types/metadata.ts b/services/web/types/metadata.ts new file mode 100644 index 0000000000..4690615f01 --- /dev/null +++ b/services/web/types/metadata.ts @@ -0,0 +1,18 @@ +type Package = { + caption: string + meta: string + score: number + snippet: string +} + +export type Metadata = { + state: { + documents: Record< + string, + { + labels: string[] + packages: Record + } + > + } +}