Skip to content

Commit bf3262a

Browse files
committed
fix: Adjust cypress component test
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 015280e commit bf3262a

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

apps/files/src/views/Navigation.cy.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
import * as InitialState from '@nextcloud/initial-state'
22
import * as L10n from '@nextcloud/l10n'
3-
import FolderSvg from '@mdi/svg/svg/folder.svg'
4-
import ShareSvg from '@mdi/svg/svg/share-variant.svg'
3+
// eslint-disable-next-line import/no-unresolved
4+
import FolderSvg from '@mdi/svg/svg/folder.svg?raw'
5+
// eslint-disable-next-line import/no-unresolved
6+
import ShareSvg from '@mdi/svg/svg/share-variant.svg?raw'
57
import { createTestingPinia } from '@pinia/testing'
68

7-
import NavigationService from '../services/Navigation.ts'
9+
import NavigationService from '../services/Navigation'
810
import NavigationView from './Navigation.vue'
911
import router from '../router/router.js'
1012
import { useViewConfigStore } from '../store/viewConfig'
13+
import { Folder } from '@nextcloud/files'
1114

1215
describe('Navigation renders', () => {
1316
const Navigation = new NavigationService() as NavigationService
1417

1518
before(() => {
1619
cy.stub(InitialState, 'loadState')
1720
.returns({
18-
used: 1000 * 1000 * 1000,
21+
used: 1024 * 1024 * 1024,
1922
quota: -1,
2023
})
2124
})
@@ -72,7 +75,7 @@ describe('Navigation API', () => {
7275
Navigation.register({
7376
id: 'sharing',
7477
name: 'Sharing',
75-
getContents: () => Promise.resolve(),
78+
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
7679
icon: ShareSvg,
7780
order: 2,
7881
})
@@ -99,7 +102,7 @@ describe('Navigation API', () => {
99102
Navigation.register({
100103
id: 'sharingin',
101104
name: 'Shared with me',
102-
getContents: () => Promise.resolve(),
105+
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
103106
parent: 'sharing',
104107
icon: ShareSvg,
105108
order: 1,
@@ -146,7 +149,7 @@ describe('Navigation API', () => {
146149
Navigation.register({
147150
id: 'files',
148151
name: 'Files',
149-
getContents: () => Promise.resolve(),
152+
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
150153
icon: FolderSvg,
151154
order: 1,
152155
})
@@ -191,7 +194,7 @@ describe('Quota rendering', () => {
191194
cy.stub(InitialState, 'loadState')
192195
.as('loadStateStats')
193196
.returns({
194-
used: 1000 * 1000 * 1000,
197+
used: 1024 * 1024 * 1024,
195198
quota: -1,
196199
})
197200

@@ -215,8 +218,8 @@ describe('Quota rendering', () => {
215218
cy.stub(InitialState, 'loadState')
216219
.as('loadStateStats')
217220
.returns({
218-
used: 1000 * 1000 * 1000,
219-
quota: 5 * 1000 * 1000 * 1000,
221+
used: 1024 * 1024 * 1024,
222+
quota: 5 * 1024 * 1024 * 1024,
220223
relative: 20, // percent
221224
})
222225

@@ -241,8 +244,8 @@ describe('Quota rendering', () => {
241244
cy.stub(InitialState, 'loadState')
242245
.as('loadStateStats')
243246
.returns({
244-
used: 5 * 1000 * 1000 * 1000,
245-
quota: 1000 * 1000 * 1000,
247+
used: 5 * 1024 * 1024 * 1024,
248+
quota: 1024 * 1024 * 1024,
246249
relative: 500, // percent
247250
})
248251

0 commit comments

Comments
 (0)