aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/tests/views/ContactsMenu.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/tests/views/ContactsMenu.spec.js')
-rw-r--r--core/src/tests/views/ContactsMenu.spec.js53
1 files changed, 21 insertions, 32 deletions
diff --git a/core/src/tests/views/ContactsMenu.spec.js b/core/src/tests/views/ContactsMenu.spec.js
index 6b438a4998e..084c3215e47 100644
--- a/core/src/tests/views/ContactsMenu.spec.js
+++ b/core/src/tests/views/ContactsMenu.spec.js
@@ -1,31 +1,20 @@
/**
- * @copyright 2023 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author 2023 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-import axios from '@nextcloud/axios'
import { mount, shallowMount } from '@vue/test-utils'
+import { describe, expect, it, vi } from 'vitest'
import ContactsMenu from '../../views/ContactsMenu.vue'
-jest.mock('@nextcloud/axios', () => ({
- post: jest.fn(),
+const axios = vi.hoisted(() => ({
+ post: vi.fn(),
+}))
+vi.mock('@nextcloud/axios', () => ({ default: axios }))
+
+vi.mock('@nextcloud/auth', () => ({
+ getCurrentUser: () => ({ uid: 'user', isAdmin: false, displayName: 'User' }),
}))
describe('ContactsMenu', function() {
@@ -55,7 +44,7 @@ describe('ContactsMenu', function() {
it('shows error view when contacts can not be loaded', async () => {
const view = mount(ContactsMenu)
axios.post.mockResolvedValue({})
- jest.spyOn(console, 'error').mockImplementation(() => {})
+ vi.spyOn(console, 'error').mockImplementation(() => {})
try {
await view.vm.handleOpen()
@@ -72,7 +61,7 @@ describe('ContactsMenu', function() {
it('shows text when there are no contacts', async () => {
const view = mount(ContactsMenu)
- axios.post.mockResolvedValue({
+ axios.post.mockResolvedValueOnce({
data: {
contacts: [],
contactsAppEnabled: false,
@@ -98,19 +87,19 @@ describe('ContactsMenu', function() {
topAction: {
title: 'Mail',
icon: 'icon-mail',
- hyperlink: 'mailto:deboraoliver%40centrexin.com'
+ hyperlink: 'mailto:deboraoliver%40centrexin.com',
},
actions: [
{
title: 'Mail',
icon: 'icon-mail',
- hyperlink: 'mailto:mathisholland%40virxo.com'
+ hyperlink: 'mailto:mathisholland%40virxo.com',
},
{
title: 'Details',
icon: 'icon-info',
- hyperlink: 'https://localhost/index.php/apps/contacts'
- }
+ hyperlink: 'https://localhost/index.php/apps/contacts',
+ },
],
lastMessage: '',
emailAddresses: [],
@@ -121,23 +110,23 @@ describe('ContactsMenu', function() {
topAction: {
title: 'Mail',
icon: 'icon-mail',
- hyperlink: 'mailto:ceciliasoto%40essensia.com'
+ hyperlink: 'mailto:ceciliasoto%40essensia.com',
},
actions: [
{
title: 'Mail',
icon: 'icon-mail',
- hyperlink: 'mailto:pearliesellers%40inventure.com'
+ hyperlink: 'mailto:pearliesellers%40inventure.com',
},
{
title: 'Details',
icon: 'icon-info',
- hyperlink: 'https://localhost/index.php/apps/contacts'
- }
+ hyperlink: 'https://localhost/index.php/apps/contacts',
+ },
],
lastMessage: 'cu',
emailAddresses: [],
- }
+ },
],
contactsAppEnabled: true,
},