Skip to content

Commit

Permalink
Merge pull request #1518 from Koc/bugfix/fix-eslint
Browse files Browse the repository at this point in the history
fix: fix eslint scripts
  • Loading branch information
susnux authored Feb 24, 2025
2 parents d324d3e + 6afe990 commit b81f7df
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions __mocks__/@nextcloud/axios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*!
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
Expand All @@ -7,12 +7,12 @@
// implemented in node 15
const timeout = (timeout: number, data = {}, signal: AbortSignal = new AbortController().signal) => {
return new Promise((resolve, reject) => {
if (signal?.aborted){
reject(new DOMException("Aborted", "AbortError"))
if (signal?.aborted) {
reject(new DOMException('Aborted', 'AbortError'))
return
}
signal.addEventListener('abort', () => {
reject(new DOMException("Aborted", "AbortError"))
reject(new DOMException('Aborted', 'AbortError'))
})

setTimeout(() => {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/upload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Cancellation', () => {
const upload = new Upload('http://domain.com/remote.php/dav/files/user/image.jpg', true, 10 * 1024 * 1024, file)

// Mock controller and spy on abort
upload['_controller'] = controller
upload._controller = controller
vi.spyOn(controller, 'abort')

expect(upload.signal).toBeInstanceOf(AbortSignal)
Expand All @@ -165,7 +165,7 @@ describe('Cancellation', () => {
const upload = new Upload('http://domain.com/remote.php/dav/files/user/image.jpg', true, 150 * 1024 * 1024, file)

// Mock controller and spy on abort
upload['_controller'] = controller
upload._controller = controller
vi.spyOn(controller, 'abort')

expect(upload.signal).toBeInstanceOf(AbortSignal)
Expand Down
16 changes: 8 additions & 8 deletions __tests__/utils/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@ import { getMaxChunksSize } from '../../lib/utils/config.js'

describe('Max chunk size tests', () => {
test('Returning valid config', () => {
Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 15 * 1024 * 1024 }}}})
Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 15 * 1024 * 1024 } } } })
expect(getMaxChunksSize()).toBe(15 * 1024 * 1024)
})

test('Returning valid config for chunking v2 minimum size', () => {
Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 4 * 1024 * 1024 }}}})
Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 4 * 1024 * 1024 } } } })
expect(getMaxChunksSize()).toBe(5 * 1024 * 1024)
})

test('Returning valid config for chunking v2 maximum chunk count', () => {
Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 5 * 1024 * 1024 }}}})
Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 5 * 1024 * 1024 } } } })
expect(getMaxChunksSize(50 * 1024 * 1024 * 10000)).toBe(5 * 1024 * 1024 * 10)
})

test('Returning disabled chunking config', () => {
Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 0 }}}})
Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 0 } } } })
expect(getMaxChunksSize()).toBe(0)

Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: -1 }}}})
Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: -1 } } } })
expect(getMaxChunksSize()).toBe(0)

Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: null }}}})
Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: null } } } })
expect(getMaxChunksSize()).toBe(0)
})

test('Returning invalid config', () => {
Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: 'test' }}}})
Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: 'test' } } } })
expect(getMaxChunksSize()).toBe(10 * 1024 * 1024)

Object.assign(window, {OC: {appConfig: {files: { max_chunk_size: undefined }}}})
Object.assign(window, { OC: { appConfig: { files: { max_chunk_size: undefined } } } })
expect(getMaxChunksSize()).toBe(10 * 1024 * 1024)
})
})
2 changes: 1 addition & 1 deletion cypress/components/UploadPicker/invalid-filenames.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,4 @@ describe.only('UploadPicker: invalid filenames (server capabilities)', { testIso
expect(requests).to.contain('now-valid.jpg')
})
})
})
})
2 changes: 1 addition & 1 deletion lib/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*!
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/filesystem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*!
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"cypress:gui": "cypress open --component",
"dev": "vite --mode development build",
"l10n:extract": "node build/extract-l10n.js",
"lint": "eslint --ext .js,.vue .",
"lint:fix": "eslint --ext .js,.vue --fix .",
"lint": "eslint --ext .js,.ts,.vue .",
"lint:fix": "eslint --ext .js,.ts,.vue --fix .",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest watch",
Expand Down

0 comments on commit b81f7df

Please sign in to comment.