diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-23 19:36:18 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-23 20:48:13 +0100 |
commit | fef9fb3bc0a93b94ca87968246fbac69c4590e2f (patch) | |
tree | 9a75b3e054c63e145d9c9feb978ace693324be4f /apps | |
parent | 20d069b56ca3226de63a7ca1e5baf76556001720 (diff) | |
download | nextcloud-server-fef9fb3bc0a93b94ca87968246fbac69c4590e2f.tar.gz nextcloud-server-fef9fb3bc0a93b94ca87968246fbac69c4590e2f.zip |
fix(tests): Add mock for `window._oc_webroot`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
7 files changed, 42 insertions, 0 deletions
diff --git a/apps/files/src/actions/downloadAction.spec.ts b/apps/files/src/actions/downloadAction.spec.ts index bc9c87c0718..cf3a3585a40 100644 --- a/apps/files/src/actions/downloadAction.spec.ts +++ b/apps/files/src/actions/downloadAction.spec.ts @@ -28,6 +28,12 @@ const view = { name: 'Files', } as View +// Mock webroot variable +beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any)._oc_webroot = '' +}) + describe('Download action conditions tests', () => { test('Default values', () => { expect(action).toBeInstanceOf(FileAction) diff --git a/apps/files/src/actions/editLocallyAction.spec.ts b/apps/files/src/actions/editLocallyAction.spec.ts index e7102b8defb..9b5d21a7f3c 100644 --- a/apps/files/src/actions/editLocallyAction.spec.ts +++ b/apps/files/src/actions/editLocallyAction.spec.ts @@ -30,6 +30,12 @@ const view = { name: 'Files', } as View +// Mock webroot variable +beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any)._oc_webroot = '' +}) + describe('Edit locally action conditions tests', () => { test('Default values', () => { expect(action).toBeInstanceOf(FileAction) diff --git a/apps/files/src/actions/favoriteAction.spec.ts b/apps/files/src/actions/favoriteAction.spec.ts index 13d24c57179..a6ab465b0dd 100644 --- a/apps/files/src/actions/favoriteAction.spec.ts +++ b/apps/files/src/actions/favoriteAction.spec.ts @@ -41,6 +41,12 @@ global.window.OC = { TAG_FAVORITE: '_$!<Favorite>!$_', } +// Mock webroot variable +beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any)._oc_webroot = '' +}) + describe('Favorite action conditions tests', () => { test('Default values', () => { const file = new File({ diff --git a/apps/files_sharing/src/actions/acceptShareAction.spec.ts b/apps/files_sharing/src/actions/acceptShareAction.spec.ts index b87cbef6a1c..0fae52c2103 100644 --- a/apps/files_sharing/src/actions/acceptShareAction.spec.ts +++ b/apps/files_sharing/src/actions/acceptShareAction.spec.ts @@ -36,6 +36,12 @@ const pendingShareView = { name: 'Pending shares', } as View +// Mock webroot variable +beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any)._oc_webroot = '' +}) + describe('Accept share action conditions tests', () => { test('Default values', () => { const file = new File({ diff --git a/apps/files_sharing/src/actions/rejectShareAction.spec.ts b/apps/files_sharing/src/actions/rejectShareAction.spec.ts index 292aec4c630..80c142052f9 100644 --- a/apps/files_sharing/src/actions/rejectShareAction.spec.ts +++ b/apps/files_sharing/src/actions/rejectShareAction.spec.ts @@ -36,6 +36,12 @@ const pendingShareView = { name: 'Pending shares', } as View +// Mock webroot variable +beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any)._oc_webroot = '' +}) + describe('Reject share action conditions tests', () => { test('Default values', () => { const file = new File({ diff --git a/apps/files_sharing/src/actions/restoreShareAction.spec.ts b/apps/files_sharing/src/actions/restoreShareAction.spec.ts index 44460a62495..f39694ac730 100644 --- a/apps/files_sharing/src/actions/restoreShareAction.spec.ts +++ b/apps/files_sharing/src/actions/restoreShareAction.spec.ts @@ -36,6 +36,12 @@ const deletedShareView = { name: 'Deleted shares', } as View +// Mock webroot variable +beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any)._oc_webroot = '' +}) + describe('Restore share action conditions tests', () => { test('Default values', () => { const file = new File({ diff --git a/apps/files_sharing/src/services/SharingService.spec.ts b/apps/files_sharing/src/services/SharingService.spec.ts index db9cb81e348..79b91c9826f 100644 --- a/apps/files_sharing/src/services/SharingService.spec.ts +++ b/apps/files_sharing/src/services/SharingService.spec.ts @@ -33,6 +33,12 @@ global.window.OC = { TAG_FAVORITE: '_$!<Favorite>!$_', } +// Mock webroot variable +beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any)._oc_webroot = '' +}) + describe('SharingService methods definitions', () => { beforeAll(() => { jest.spyOn(axios, 'get').mockImplementation(async (): Promise<any> => { |