Skip to content

Commit

Permalink
fix: Adjust cypress component test
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Oct 6, 2023
1 parent 951ab7a commit acdc319
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions apps/files/src/views/Navigation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import * as InitialState from '@nextcloud/initial-state'
import * as L10n from '@nextcloud/l10n'
import FolderSvg from '@mdi/svg/svg/folder.svg'
import ShareSvg from '@mdi/svg/svg/share-variant.svg'
// eslint-disable-next-line import/no-unresolved
import FolderSvg from '@mdi/svg/svg/folder.svg?raw'
// eslint-disable-next-line import/no-unresolved
import ShareSvg from '@mdi/svg/svg/share-variant.svg?raw'
import { createTestingPinia } from '@pinia/testing'

import NavigationService from '../services/Navigation.ts'
import NavigationService from '../services/Navigation'
import NavigationView from './Navigation.vue'
import router from '../router/router.js'
import { useViewConfigStore } from '../store/viewConfig'
import { Folder } from '@nextcloud/files'

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

before(() => {
cy.stub(InitialState, 'loadState')
.returns({
used: 1000 * 1000 * 1000,
used: 1024 * 1024 * 1024,
quota: -1,
})
})
Expand Down Expand Up @@ -72,7 +75,7 @@ describe('Navigation API', () => {
Navigation.register({
id: 'sharing',
name: 'Sharing',
getContents: () => Promise.resolve(),
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
icon: ShareSvg,
order: 2,
})
Expand All @@ -99,7 +102,7 @@ describe('Navigation API', () => {
Navigation.register({
id: 'sharingin',
name: 'Shared with me',
getContents: () => Promise.resolve(),
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
parent: 'sharing',
icon: ShareSvg,
order: 1,
Expand Down Expand Up @@ -146,7 +149,7 @@ describe('Navigation API', () => {
Navigation.register({
id: 'files',
name: 'Files',
getContents: () => Promise.resolve(),
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
icon: FolderSvg,
order: 1,
})
Expand Down Expand Up @@ -191,7 +194,7 @@ describe('Quota rendering', () => {
cy.stub(InitialState, 'loadState')
.as('loadStateStats')
.returns({
used: 1000 * 1000 * 1000,
used: 1024 * 1024 * 1024,
quota: -1,
})

Expand All @@ -215,8 +218,8 @@ describe('Quota rendering', () => {
cy.stub(InitialState, 'loadState')
.as('loadStateStats')
.returns({
used: 1000 * 1000 * 1000,
quota: 5 * 1000 * 1000 * 1000,
used: 1024 * 1024 * 1024,
quota: 5 * 1024 * 1024 * 1024,
relative: 20, // percent
})

Expand All @@ -241,8 +244,8 @@ describe('Quota rendering', () => {
cy.stub(InitialState, 'loadState')
.as('loadStateStats')
.returns({
used: 5 * 1000 * 1000 * 1000,
quota: 1000 * 1000 * 1000,
used: 5 * 1024 * 1024 * 1024,
quota: 1024 * 1024 * 1024,
relative: 500, // percent
})

Expand Down

0 comments on commit acdc319

Please sign in to comment.