diff options
Diffstat (limited to 'apps/dav/src/views/CalDavSettings.spec.js')
-rw-r--r-- | apps/dav/src/views/CalDavSettings.spec.js | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/apps/dav/src/views/CalDavSettings.spec.js b/apps/dav/src/views/CalDavSettings.spec.js index e5f18999fe0..7a4345b3ddf 100644 --- a/apps/dav/src/views/CalDavSettings.spec.js +++ b/apps/dav/src/views/CalDavSettings.spec.js @@ -3,40 +3,33 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ import { render } from '@testing-library/vue' +import { beforeEach, describe, expect, test, vi } from 'vitest' + import CalDavSettings from './CalDavSettings.vue' -// eslint-disable-next-line no-unused-vars -import { generateUrl } from '@nextcloud/router' -jest.mock('@nextcloud/axios') -jest.mock('@nextcloud/router', () => { +vi.mock('@nextcloud/axios') +vi.mock('@nextcloud/router', () => { return { generateUrl(url) { return url }, } }) -jest.mock('@nextcloud/initial-state', () => { +vi.mock('@nextcloud/initial-state', () => { return { - loadState: jest.fn(() => 'https://docs.nextcloud.com/server/23/go.php?to=user-sync-calendars'), + loadState: vi.fn(() => 'https://docs.nextcloud.com/server/23/go.php?to=user-sync-calendars'), } }) describe('CalDavSettings', () => { - const originalOC = global.OC - const originalOCP = global.OCP - beforeEach(() => { - global.OC = { requestToken: 'secret' } - global.OCP = { + window.OC = { requestToken: 'secret' } + window.OCP = { AppConfig: { - setValue: jest.fn(), + setValue: vi.fn(), }, } }) - afterAll(() => { - global.OC = originalOC - global.OCP = originalOCP - }) test('interactions', async () => { const TLUtils = render( @@ -53,28 +46,28 @@ describe('CalDavSettings', () => { }, }, Vue => { - Vue.prototype.$t = jest.fn((app, text) => text) - } + Vue.prototype.$t = vi.fn((app, text) => text) + }, ) expect(TLUtils.container).toMatchSnapshot() const sendInvitations = TLUtils.getByLabelText( - 'Send invitations to attendees' + 'Send invitations to attendees', ) expect(sendInvitations).toBeChecked() const generateBirthdayCalendar = TLUtils.getByLabelText( - 'Automatically generate a birthday calendar' + 'Automatically generate a birthday calendar', ) expect(generateBirthdayCalendar).toBeChecked() const sendEventReminders = TLUtils.getByLabelText( - 'Send notifications for events' + 'Send notifications for events', ) expect(sendEventReminders).toBeChecked() const sendEventRemindersToSharedUsers = TLUtils.getByLabelText( - 'Send reminder notifications to calendar sharees as well' + 'Send reminder notifications to calendar sharees as well', ) expect(sendEventRemindersToSharedUsers).toBeChecked() const sendEventRemindersPush = TLUtils.getByLabelText( - 'Enable notifications for events via push' + 'Enable notifications for events via push', ) expect(sendEventRemindersPush).toBeChecked() |