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: '_$!!$_', } +// 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: '_$!!$_', } +// 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 => { diff --git a/core/js/tests/specs/l10nSpec.js b/core/js/tests/specs/l10nSpec.js index af01526c569..c1d596badf6 100644 --- a/core/js/tests/specs/l10nSpec.js +++ b/core/js/tests/specs/l10nSpec.js @@ -13,10 +13,15 @@ describe('OC.L10N tests', function() { beforeEach(function() { window._oc_appswebroots[TEST_APP] = OC.getRootPath() + '/apps3/jsunittestapp'; + + window.OC = window.OC ?? {} + window.OC.appswebroots = window.OC.appswebroots || {} + window.OC.appswebroots[TEST_APP] = OC.getRootPath() + '/apps3/jsunittestapp' }); afterEach(function() { OC.L10N._unregister(TEST_APP); delete window._oc_appswebroots[TEST_APP]; + delete window.OC.appswebroots[TEST_APP]; }); describe('text translation', function() { @@ -121,6 +126,7 @@ describe('OC.L10N tests', function() { expect(callbackStub.notCalled).toEqual(true); var req = fakeServer.requests[0]; + console.warn('fff-', window.OC.appswebroots) loading .then(promiseStub) .then(function() {