Skip to content

Commit

Permalink
Merge pull request #667 from nextcloud/fix/oc-win
Browse files Browse the repository at this point in the history
fix: Do not export the declaration of window.OC
  • Loading branch information
ChristophWurst committed Jun 14, 2023
2 parents df1a4f9 + c5bbd90 commit 97da8b8
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 60 deletions.
7 changes: 0 additions & 7 deletions __tests__/fileAction.spec.ts
@@ -1,13 +1,6 @@
import { getFileActions, registerFileAction, FileAction } from '../lib/fileAction'
import logger from '../lib/utils/logger';

declare global {
interface Window {
OC: any;
_nc_fileactions: FileAction[] | undefined;
}
}

describe('FileActions init', () => {

beforeEach(() => {
Expand Down
6 changes: 0 additions & 6 deletions __tests__/humanFileSize.spec.ts
@@ -1,11 +1,5 @@
import { formatFileSize } from '../lib/humanfilesize'

declare global {
interface Window {
OC: any;
}
}

describe('humanFileSize', () => {
describe('formatFileSize', () => {
it('renders file sizes with the correct unit', function() {
Expand Down
7 changes: 0 additions & 7 deletions __tests__/index.spec.ts
Expand Up @@ -18,13 +18,6 @@ import { FileType as FileTypeSource } from '../lib/files/fileType'
import { Entry, NewFileMenu } from '../lib/newFileMenu';
import { FileAction, registerFileAction, getFileActions } from '../lib/fileAction'

declare global {
interface Window {
OC: any;
_nc_newfilemenu: NewFileMenu | undefined;
}
}

describe('Exports checks', () => {
test('formatFileSize', () => {
expect(formatFileSize).toBeTruthy()
Expand Down
7 changes: 0 additions & 7 deletions __tests__/newFileMenu.spec.ts
@@ -1,13 +1,6 @@
import { NewFileMenu, getNewFileMenu, type Entry } from '../lib/newFileMenu'
import logger from '../lib/utils/logger';

declare global {
interface Window {
OC: any;
_nc_newfilemenu: NewFileMenu | undefined;
}
}

describe('NewFileMenu init', () => {
test('Initializing NewFileMenu', () => {
logger.debug = jest.fn()
Expand Down
12 changes: 6 additions & 6 deletions jest.config.js
Expand Up @@ -4,12 +4,12 @@ module.exports = {
coveragePathIgnorePatterns: ['lib/utils/logger.ts'],
testEnvironment: 'jsdom',
preset: 'ts-jest/presets/js-with-ts',
globals: {
'ts-jest': {
tsconfig: '__tests__/tsconfig.json',
},
},
transformIgnorePatterns: [
'node_modules/(?!(abcde|fghij)/)',
'node_modules',
],
transform: {
'^.+\\.tsx?$': ['ts-jest', {
tsconfig: '__tests__/tsconfig.json',
}]
},
}
8 changes: 0 additions & 8 deletions lib/index.ts
Expand Up @@ -33,14 +33,6 @@ export { Node } from './files/node'
export { Permission, parseWebdavPermissions } from './permissions'
export { FileAction, registerFileAction, getFileActions } from './fileAction'

declare global {
interface Window {
OC: any;
_nc_newfilemenu: NewFileMenu | undefined;
_nc_fileactions: FileAction[] | undefined;
}
}

/**
* Add a new menu entry to the upload manager menu
*/
Expand Down

0 comments on commit 97da8b8

Please sign in to comment.