aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/tests/components/ContactsMenu/Contact.spec.js
blob: e83f75bfd15ad4986d6b09b5dce8fc6da6961373 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

import { describe, expect, it } from 'vitest'
import { shallowMount } from '@vue/test-utils'

import Contact from '../../../components/ContactsMenu/Contact.vue'

describe('Contact', function() {
	it('links to the top action', () => {
		const view = shallowMount(Contact, {
			propsData: {
				contact: {
					id: null,
					fullName: 'Acosta Lancaster',
					topAction: {
						title: 'Mail',
						icon: 'icon-mail',
						hyperlink: 'mailto:deboraoliver%40centrexin.com',
					},
					emailAddresses: [],
					actions: [
						{
							title: 'Mail',
							icon: 'icon-mail',
							hyperlink: 'mailto:mathisholland%40virxo.com',
						},
						{
							title: 'Details',
							icon: 'icon-info',
							hyperlink: 'https://localhost/index.php/apps/contacts',
						},
					],
					lastMessage: '',
				},
			},
		})

		expect(view.find('li a').exists()).toBe(true)
		expect(view.find('li a').attributes('href')).toBe('mailto:deboraoliver%40centrexin.com')
	})
})