diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-02 12:13:43 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-09 17:13:30 +0200 |
commit | 24c01695bb0023fa85dab29cf7170d9596456d5b (patch) | |
tree | 1369336c1531024d3b67fa6fff2eafad24b6ad92 /apps/files/src | |
parent | 691f570237e26398aa22f40c0efca23141d5583e (diff) | |
download | nextcloud-server-24c01695bb0023fa85dab29cf7170d9596456d5b.tar.gz nextcloud-server-24c01695bb0023fa85dab29cf7170d9596456d5b.zip |
test: Adjust Typescript definitions for OCP and OC
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/actions/deleteAction.spec.ts | 1 | ||||
-rw-r--r-- | apps/files/src/actions/favoriteAction.spec.ts | 1 | ||||
-rw-r--r-- | apps/files/src/actions/openFolderAction.spec.ts | 3 | ||||
-rw-r--r-- | apps/files/src/actions/openInFilesAction.spec.ts | 2 | ||||
-rw-r--r-- | apps/files/src/actions/sidebarAction.spec.ts | 1 | ||||
-rw-r--r-- | apps/files/src/actions/viewInFolderAction.spec.ts | 4 | ||||
-rw-r--r-- | apps/files/src/main.ts | 7 |
7 files changed, 16 insertions, 3 deletions
diff --git a/apps/files/src/actions/deleteAction.spec.ts b/apps/files/src/actions/deleteAction.spec.ts index 0dda5788a85..0ed19894c3f 100644 --- a/apps/files/src/actions/deleteAction.spec.ts +++ b/apps/files/src/actions/deleteAction.spec.ts @@ -191,6 +191,7 @@ describe('Delete action execute tests', () => { jest.spyOn(eventBus, 'emit') const confirmMock = jest.fn() + // @ts-expect-error We only mock what needed window.OC = { dialogs: { confirmDestructive: confirmMock } } const file1 = new File({ diff --git a/apps/files/src/actions/favoriteAction.spec.ts b/apps/files/src/actions/favoriteAction.spec.ts index e8bb1ce28b5..71ca0263d33 100644 --- a/apps/files/src/actions/favoriteAction.spec.ts +++ b/apps/files/src/actions/favoriteAction.spec.ts @@ -21,6 +21,7 @@ const favoriteView = { } as View global.window.OC = { + // @ts-expect-error This constant is currently missing in @nextcloud/typings TAG_FAVORITE: '_$!<Favorite>!$_', } diff --git a/apps/files/src/actions/openFolderAction.spec.ts b/apps/files/src/actions/openFolderAction.spec.ts index 57827ddc208..7ce79e0ad17 100644 --- a/apps/files/src/actions/openFolderAction.spec.ts +++ b/apps/files/src/actions/openFolderAction.spec.ts @@ -101,6 +101,7 @@ describe('Open folder action enabled tests', () => { describe('Open folder action execute tests', () => { test('Open folder', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const folder = new Folder({ @@ -119,6 +120,7 @@ describe('Open folder action execute tests', () => { test('Open folder fails without node', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const exec = await action.exec(null as unknown as Node, view, '/') @@ -128,6 +130,7 @@ describe('Open folder action execute tests', () => { test('Open folder fails without Folder', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const file = new File({ diff --git a/apps/files/src/actions/openInFilesAction.spec.ts b/apps/files/src/actions/openInFilesAction.spec.ts index f8745174b96..c1a80ad4425 100644 --- a/apps/files/src/actions/openInFilesAction.spec.ts +++ b/apps/files/src/actions/openInFilesAction.spec.ts @@ -43,6 +43,7 @@ describe('Open in files action enabled tests', () => { describe('Open in files action execute tests', () => { test('Open in files', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const file = new File({ @@ -64,6 +65,7 @@ describe('Open in files action execute tests', () => { test('Open in files with folder', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const file = new Folder({ diff --git a/apps/files/src/actions/sidebarAction.spec.ts b/apps/files/src/actions/sidebarAction.spec.ts index 9e1415b0b2c..2c23755a84d 100644 --- a/apps/files/src/actions/sidebarAction.spec.ts +++ b/apps/files/src/actions/sidebarAction.spec.ts @@ -110,6 +110,7 @@ describe('Open sidebar action exec tests', () => { const openMock = jest.fn() window.OCA = { Files: { Sidebar: { open: openMock } } } const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const file = new File({ diff --git a/apps/files/src/actions/viewInFolderAction.spec.ts b/apps/files/src/actions/viewInFolderAction.spec.ts index cad99d25ab0..89519f1b64d 100644 --- a/apps/files/src/actions/viewInFolderAction.spec.ts +++ b/apps/files/src/actions/viewInFolderAction.spec.ts @@ -114,6 +114,7 @@ describe('View in folder action enabled tests', () => { describe('View in folder action execute tests', () => { test('View in folder', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const file = new File({ @@ -133,6 +134,7 @@ describe('View in folder action execute tests', () => { test('View in (sub) folder', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const file = new File({ @@ -153,6 +155,7 @@ describe('View in folder action execute tests', () => { test('View in folder fails without node', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const exec = await action.exec(null as unknown as Node, view, '/') @@ -162,6 +165,7 @@ describe('View in folder action execute tests', () => { test('View in folder fails without File', async () => { const goToRouteMock = jest.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const folder = new Folder({ diff --git a/apps/files/src/main.ts b/apps/files/src/main.ts index 9b057a5d378..62c4894d1e4 100644 --- a/apps/files/src/main.ts +++ b/apps/files/src/main.ts @@ -19,9 +19,10 @@ __webpack_nonce__ = btoa(getRequestToken()) declare global { interface Window { - OC: Nextcloud.v28.OC; - OCA: Record<string, unknown>; - OCP: Nextcloud.v28.OCP; + OC: Nextcloud.v29.OC + OCP: Nextcloud.v29.OCP + // eslint-disable-next-line @typescript-eslint/no-explicit-any + OCA: Record<string, any> } } |