mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix(tests): Add mock for window._oc_webroot
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
20d069b56c
commit
fef9fb3bc0
8 changed files with 48 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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> => {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue