Skip to content

Commit 2eeb7b5

Browse files
committed
chore: adjust import extensions
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 508dee0 commit 2eeb7b5

28 files changed

Lines changed: 79 additions & 74 deletions

__tests__/dav/dav.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import { readFile } from 'node:fs/promises'
1010
// required as default URL will be the DOM URL class which will use the window.location
1111
import { URL as FileURL } from 'node:url'
1212
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
13-
import { File, Folder, NodeStatus } from '../../lib'
1413
import {
1514
defaultRemoteURL,
1615
defaultRootPath,
1716
getFavoriteNodes,
1817
getFavoritesReport,
1918
resultToNode,
20-
} from '../../lib/dav/index'
19+
} from '../../lib/dav/index.ts'
20+
import { File, Folder, NodeStatus } from '../../lib/index.ts'
2121

2222
vi.mock('@nextcloud/auth')
2323
vi.mock('@nextcloud/router')

__tests__/dav/davPermissions.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55
import { describe, expect, it } from 'vitest'
6-
import { parsePermissions } from '../../lib/dav/davPermissions'
7-
import { Permission } from '../../lib/permissions'
6+
import { parsePermissions } from '../../lib/dav/davPermissions.ts'
7+
import { Permission } from '../../lib/permissions.ts'
88

99
const dataSet = [
1010
{ input: undefined, permissions: Permission.NONE },

__tests__/dav/davProperties.spec.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { XMLValidator } from 'fast-xml-parser'
21
/**
32
* SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
43
* SPDX-License-Identifier: AGPL-3.0-or-later
54
*/
5+
6+
import { XMLValidator } from 'fast-xml-parser'
67
import { beforeEach, describe, expect, test, vi } from 'vitest'
78
import {
89
defaultDavNamespaces,
@@ -13,15 +14,8 @@ import {
1314
getFavoritesReport,
1415
getRecentSearch,
1516
registerDavProperty,
16-
} from '../../lib/dav/davProperties'
17-
import logger from '../../lib/utils/logger'
18-
19-
declare global {
20-
interface Window {
21-
_nc_dav_namespaces?: string[]
22-
_nc_dav_properties?: string[]
23-
}
24-
}
17+
} from '../../lib/dav/davProperties.ts'
18+
import logger from '../../lib/utils/logger.ts'
2519

2620
describe('DAV Properties', () => {
2721
beforeEach(() => {

__tests__/dav/public-shares.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import type { ArgumentsType } from 'vitest'
76
import type { FileStat } from 'webdav'
8-
import type { resultToNode as IResultToNode } from '../../lib/dav/dav'
7+
import type { resultToNode as IResultToNode } from '../../lib/dav/dav.ts'
98

109
import { beforeEach, describe, expect, test, vi } from 'vitest'
1110

@@ -37,14 +36,14 @@ describe('DAV path functions', () => {
3736
test('root path is correct on public shares', async () => {
3837
mockPublicShare()
3938

40-
const { getRootPath } = await import('../../lib/dav/dav')
39+
const { getRootPath } = await import('../../lib/dav/dav.ts')
4140
expect(getRootPath()).toBe('/files/token-1234')
4241
})
4342

4443
test('remote URL is correct on public shares', async () => {
4544
mockPublicShare()
4645

47-
const { getRemoteURL } = await import('../../lib/dav/dav')
46+
const { getRemoteURL } = await import('../../lib/dav/dav.ts')
4847
expect(getRemoteURL()).toBe('https://example.com/public.php/dav')
4948
})
5049
})
@@ -56,8 +55,8 @@ describe('on public shares', () => {
5655
})
5756

5857
// Wrapper function as we can not static import the function to allow mocking the modules
59-
const resultToNode = async (...rest: ArgumentsType<typeof IResultToNode>) => {
60-
const { resultToNode } = await import('../../lib/dav/dav')
58+
const resultToNode = async (...rest: Parameters<typeof IResultToNode>) => {
59+
const { resultToNode } = await import('../../lib/dav/dav.ts')
6160
return resultToNode(...rest)
6261
}
6362

__tests__/fileListFilter.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import type { IFileListFilterChip } from '../lib'
6+
import type { IFileListFilterChip } from '../lib/fileListFilters.ts'
77

88
import { subscribe } from '@nextcloud/event-bus'
99
import { beforeEach, describe, expect, test, vi } from 'vitest'
10-
import { FileListFilter, getFileListFilters, registerFileListFilter, unregisterFileListFilter } from '../lib'
10+
import { FileListFilter, getFileListFilters, registerFileListFilter, unregisterFileListFilter } from '../lib/fileListFilters.ts'
1111

1212
class TestFilter extends FileListFilter {
1313
public testUpdated() {

__tests__/files/node.spec.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import type { Attribute, NodeData } from '../../lib/node/index.ts'
7+
import type { TNodeStatus } from '../../lib/node/node.ts'
78

89
import { describe, expect, test } from 'vitest'
910
import { File, Folder, NodeStatus } from '../../lib/node/index.ts'
@@ -343,8 +344,10 @@ describe('Sanity checks', () => {
343344
displayname: 'test',
344345
owner: 'emma',
345346
})
346-
// @ts-expect-error wrong type error check
347-
expect(() => { file.displayname = true }).toThrowError('Invalid displayname')
347+
expect(() => {
348+
// @ts-expect-error wrong type error check
349+
file.displayname = true
350+
}).toThrowError('Invalid displayname')
348351
})
349352

350353
test('Invalid mtime', () => {
@@ -360,8 +363,10 @@ describe('Sanity checks', () => {
360363
root: '/files/emma',
361364
owner: 'emma',
362365
})
363-
// @ts-expect-error wrong type error check
364-
expect(() => { file.mtime = 'invalid' }).toThrowError('Invalid mtime type')
366+
expect(() => {
367+
// @ts-expect-error wrong type error check
368+
file.mtime = 'invalid'
369+
}).toThrowError('Invalid mtime type')
365370
})
366371

367372
test('Invalid crtime', () => {
@@ -388,9 +393,13 @@ describe('Sanity checks', () => {
388393
mime: 'image/jpeg',
389394
owner: 'emma',
390395
})
391-
// @ts-expect-error wrong type error check
392-
expect(() => { file.mime = 1234 }).toThrowError('Missing or invalid mandatory mime')
393-
expect(() => { file.mime = 'image' }).toThrowError('Missing or invalid mandatory mime')
396+
expect(() => {
397+
// @ts-expect-error wrong type error check
398+
file.mime = 1234
399+
}).toThrowError('Missing or invalid mandatory mime')
400+
expect(() => {
401+
file.mime = 'image'
402+
}).toThrowError('Missing or invalid mandatory mime')
394403
})
395404

396405
test('Invalid attributes', () => {
@@ -485,7 +494,7 @@ describe('Sanity checks', () => {
485494
root: '/files/emma',
486495
mime: 'image/jpeg',
487496
owner: 'emma',
488-
status: 'invalid' as unknown as NodeStatus,
497+
status: 'invalid' as unknown as TNodeStatus,
489498
})).toThrowError('Status must be a valid NodeStatus')
490499

491500
const file = new File({

__tests__/navigation.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { describe, expect, it, vi } from 'vitest'
77
import { View } from '../lib/index.ts'
8-
import { getNavigation, Navigation } from '../lib/navigation/navigation'
8+
import { getNavigation, Navigation } from '../lib/navigation/navigation.ts'
99
import { mockView } from './fixtures/view.ts'
1010

1111
describe('getNavigation', () => {

__tests__/newFileMenu.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { addNewFileMenuEntry, getNewFileMenu, getNewFileMenuEntries } from '../l
1010
import { NewMenu, NewMenuEntryCategory } from '../lib/newMenu/NewMenu.ts'
1111
import { Folder } from '../lib/node/index.ts'
1212
import { Permission } from '../lib/permissions.ts'
13-
import logger from '../lib/utils/logger'
13+
import logger from '../lib/utils/logger.ts'
1414

1515
describe('NewFileMenu init', () => {
1616
test('Initializing NewFileMenu', () => {

__tests__/utils/fileSize.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { setLocale } from '@nextcloud/l10n'
77
import { beforeEach, describe, expect, it } from 'vitest'
8-
import { formatFileSize, parseFileSize } from '../../lib/index'
8+
import { formatFileSize, parseFileSize } from '../../lib/index.ts'
99

1010
describe('humanFileSize', () => {
1111
beforeEach(() => setLocale('en'))

__tests__/utils/fileSorting.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import type { Attribute } from '../../lib/node/index.ts'
77

88
import { describe, expect, test } from 'vitest'
9-
import { File, FilesSortingMode, Folder, sortNodes as originalSortNodes } from '../../lib'
9+
import { File, FilesSortingMode, Folder, sortNodes as originalSortNodes } from '../../lib/index.ts'
1010

1111
function file(name: string, size?: number, modified?: number, favorite = false, attributes: Attribute = {}) {
1212
return new File({

0 commit comments

Comments
 (0)