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/files_sharing/src | |
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/files_sharing/src')
4 files changed, 24 insertions, 0 deletions
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> => { |