Skip to content

Commit dabf899

Browse files
committed
fixup! chore: upgrade to @nextcloud/files@3.0.0-beta.16
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 54fcb69 commit dabf899

File tree

6 files changed

+39
-23
lines changed

6 files changed

+39
-23
lines changed

apps/files/src/views/favorites.spec.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*
2121
*/
22+
import { basename } from 'path'
2223
import { expect } from '@jest/globals'
23-
import * as initialState from '@nextcloud/initial-state'
24-
import { Folder, getNavigation, basename } from 'path'
24+
import { Folder, Navigation, getNavigation } from '@nextcloud/files'
2525
import * as eventBus from '@nextcloud/event-bus'
26+
import * as initialState from '@nextcloud/initial-state'
2627

2728
import { action } from '../actions/favoriteAction'
2829
import * as favoritesService from '../services/Favorites'
@@ -36,14 +37,21 @@ global.window.OC = {
3637
TAG_FAVORITE: '_$!<Favorite>!$_',
3738
}
3839

40+
declare global {
41+
interface Window {
42+
_nc_navigation?: Navigation
43+
}
44+
}
45+
3946
describe('Favorites view definition', () => {
4047
let Navigation
4148
beforeEach(() => {
4249
Navigation = getNavigation()
50+
expect(window._nc_navigation).toBeDefined()
4351
})
4452

45-
afterAll(() => {
46-
delete window.OCP
53+
afterEach(() => {
54+
delete window._nc_navigation
4755
})
4856

4957
test('Default empty favorite view', () => {
@@ -114,8 +122,8 @@ describe('Dynamic update of favourite folders', () => {
114122
Navigation = getNavigation()
115123
})
116124

117-
afterAll(() => {
118-
delete window.OCP
125+
afterEach(() => {
126+
delete window._nc_navigation
119127
})
120128

121129
test('Add a favorite folder creates a new entry in the navigation', async () => {

apps/files/src/views/favorites.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*
2121
*/
22+
import { basename } from 'path'
2223
import { getLanguage, translate as t } from '@nextcloud/l10n'
24+
import { loadState } from '@nextcloud/initial-state'
25+
import { Node, FileType, View, getNavigation } from '@nextcloud/files'
26+
import { subscribe } from '@nextcloud/event-bus'
2327
import FolderSvg from '@mdi/svg/svg/folder.svg?raw'
2428
import StarSvg from '@mdi/svg/svg/star.svg?raw'
2529

26-
import { basename } from 'path'
2730
import { getContents } from '../services/Favorites'
2831
import { hashCode } from '../utils/hashUtils'
29-
import { loadState } from '@nextcloud/initial-state'
30-
import { Node, FileType, View, getNavigation, subscribe } from '@nextcloud/event-bus'
3132
import logger from '../logger'
3233

3334
export const generateFolderView = function(folder: string, index = 0): View {

apps/files_external/src/utils/externalStorageUtils.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*
2121
*/
22-
import { File, Folder, Permission, isNodeExternalStorage } from './externalStorageUtils'
2322
import { expect } from '@jest/globals'
23+
import { File, Folder, Permission } from '@nextcloud/files'
24+
import { isNodeExternalStorage } from './externalStorageUtils'
2425

2526
describe('Is node an external storage', () => {
2627
test('A Folder with a backend and a valid scope is an external storage', () => {

apps/files_sharing/src/actions/openInFilesAction.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
*
2121
*/
2222
import { expect } from '@jest/globals'
23-
import { File, Permission, View } from '@nextcloud/files'
23+
import { File, Permission, View, DefaultType, FileAction } from '@nextcloud/files'
2424

2525
import '../main'
2626
import { action } from './openInFilesAction'
27-
import { DefaultType, FileAction, deletedSharesViewId, pendingSharesViewId, sharedWithOthersViewId, sharedWithYouViewId, sharesViewId, sharingByLinksViewId } from '../views/shares'
27+
import { deletedSharesViewId, pendingSharesViewId, sharedWithOthersViewId, sharedWithYouViewId, sharesViewId, sharingByLinksViewId } from '../views/shares'
2828

2929
const view = {
3030
id: 'files',

apps/files_sharing/src/views/shares.spec.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,28 @@
2121
*/
2222
/* eslint-disable n/no-extraneous-import */
2323
import { expect } from '@jest/globals'
24+
import { Folder, Navigation, View, getNavigation } from '@nextcloud/files'
2425
import axios from '@nextcloud/axios'
2526

27+
import '../main'
2628
import { type OCSResponse } from '../services/SharingService'
2729
import registerSharingViews from './shares'
2830

29-
import '../main'
30-
import { Folder, getNavigation } from '@nextcloud/files'
31+
declare global {
32+
interface Window {
33+
_nc_navigation?: Navigation
34+
}
35+
}
3136

3237
describe('Sharing views definition', () => {
3338
let Navigation
3439
beforeEach(() => {
3540
Navigation = getNavigation()
41+
expect(window._nc_navigation).toBeDefined()
3642
})
3743

3844
afterAll(() => {
39-
delete window.OCP
45+
delete window._nc_navigation
4046
})
4147

4248
test('Default values', () => {
@@ -45,8 +51,8 @@ describe('Sharing views definition', () => {
4551
expect(Navigation.views.length).toBe(0)
4652

4753
registerSharingViews()
48-
const shareOverviewView = Navigation.views.find(view => view.id === 'shareoverview') as Navigation
49-
const sharesChildViews = Navigation.views.filter(view => view.parent === 'shareoverview') as Navigation[]
54+
const shareOverviewView = Navigation.views.find(view => view.id === 'shareoverview') as View
55+
const sharesChildViews = Navigation.views.filter(view => view.parent === 'shareoverview') as View[]
5056

5157
expect(Navigation.register).toHaveBeenCalledTimes(6)
5258

@@ -89,12 +95,12 @@ describe('Sharing views definition', () => {
8995
describe('Sharing views contents', () => {
9096
let Navigation
9197
beforeEach(() => {
92-
Navigation = new NavigationService()
93-
window.OCP = { Files: { Navigation } }
98+
Navigation = getNavigation()
99+
expect(window._nc_navigation).toBeDefined()
94100
})
95101

96102
afterAll(() => {
97-
delete window.OCP
103+
delete window._nc_navigation
98104
})
99105

100106
test('Sharing overview get contents', async () => {
@@ -115,7 +121,7 @@ describe('Sharing views contents', () => {
115121

116122
registerSharingViews()
117123
expect(Navigation.views.length).toBe(6)
118-
Navigation.views.forEach(async (view: Navigation) => {
124+
Navigation.views.forEach(async (view: View) => {
119125
const content = await view.getContents('/')
120126
expect(content.contents).toStrictEqual([])
121127
expect(content.folder).toBeInstanceOf(Folder)

apps/files_sharing/src/views/shares.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
*
2121
*/
2222
import { translate as t } from '@nextcloud/l10n'
23+
import { View, getNavigation } from '@nextcloud/files'
2324
import AccountClockSvg from '@mdi/svg/svg/account-clock.svg?raw'
2425
import AccountGroupSvg from '@mdi/svg/svg/account-group.svg?raw'
26+
import AccountPlusSvg from '@mdi/svg/svg/account-plus.svg?raw'
2527
import AccountSvg from '@mdi/svg/svg/account.svg?raw'
2628
import DeleteSvg from '@mdi/svg/svg/delete.svg?raw'
2729
import LinkSvg from '@mdi/svg/svg/link.svg?raw'
28-
import AccountPlusSvg from '@mdi/svg/svg/account-plus.svg?raw'
2930

3031
import { getContents } from '../services/SharingService'
31-
import { View, getNavigation } from '@nextcloud/files'
3232

3333
export const sharesViewId = 'shareoverview'
3434
export const sharedWithYouViewId = 'sharingin'

0 commit comments

Comments
 (0)