Skip to content

Commit 0cc41f1

Browse files
susnuxAndyScherzinger
authored andcommitted
test: adjust for dependency updates
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 8ad14fc commit 0cc41f1

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

apps/files/src/actions/openLocallyAction.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import { action } from './openLocallyAction.ts'
1313

1414
vi.mock('@nextcloud/auth')
1515
vi.mock('@nextcloud/axios')
16+
// Only mock the toasts, the dialog classes are needed to test the confirmation dialog
17+
vi.mock('@nextcloud/dialogs', async (importOriginal) => ({
18+
...await importOriginal<typeof nextcloudDialogs>(),
19+
showError: vi.fn(),
20+
}))
1621

1722
const view = {
1823
id: 'files',

apps/files/src/services/DropServiceUtils.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { logger } from '../utils/logger.ts'
1010
import { dataTransferToFileTree } from './DropService.ts'
1111
import { Directory, traverseTree } from './DropServiceUtils.ts'
1212

13+
vi.mock('@nextcloud/dialogs')
14+
1315
const dataTree = {
1416
'file0.txt': ['Hello, world!', 1234567890],
1517
dir1: {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('DialogConfirmFileHidden', () => {
2525
})
2626

2727
await expect(component.findByRole('dialog', { name: 'Rename file to hidden' })).resolves.not.toThrow()
28-
expect((component.getByRole('checkbox', { name: /Do not show this dialog again/i }) as HTMLInputElement).checked).toBe(false)
28+
expect((component.getByRole('switch', { name: /Do not show this dialog again/i }) as HTMLInputElement).checked).toBe(false)
2929
await expect(component.findByRole('button', { name: 'Cancel' })).resolves.not.toThrow()
3030
await expect(component.findByRole('button', { name: 'Rename' })).resolves.not.toThrow()
3131
})
@@ -86,7 +86,7 @@ describe('DialogConfirmFileHidden', () => {
8686
},
8787
})
8888

89-
await fireEvent.click(component.getByRole('checkbox', { name: /Do not show this dialog again/i }))
89+
await fireEvent.click(component.getByRole('switch', { name: /Do not show this dialog again/i }))
9090
const store = useUserConfigStore()
9191
expect(store.update).toHaveBeenCalledOnce()
9292
expect(store.update).toHaveBeenCalledWith('show_dialog_file_extension', false)

0 commit comments

Comments
 (0)