forked from npmx-dev/npmx.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppFooter.spec.ts
More file actions
35 lines (31 loc) · 1.33 KB
/
AppFooter.spec.ts
File metadata and controls
35 lines (31 loc) · 1.33 KB
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
import { describe, expect, it } from 'vitest'
import { mountSuspended } from '@nuxt/test-utils/runtime'
import AppFooter from '~/components/AppFooter.vue'
/* check nuxt module at modules/build-env.ts */
describe('AppFooter', () => {
it('BuildEnvironment is properly displayed at settings', async () => {
const buildInfo = useAppConfig().buildInfo
const component = await mountSuspended(AppFooter, {
route: '/settings',
})
const envSpan = component.find('span.tracking-wider')
expect(envSpan.exists()).toBe(true)
expect(envSpan.text()).toBe(buildInfo.env)
const commitLink = component.find(`a[href$="/commit/${buildInfo.commit}"]`)
expect(commitLink.exists()).toBe(true)
const tagLink = component.find(`a[href$="/tag/v${buildInfo.commit}"]`)
expect(tagLink.exists()).toBe(false)
})
it('BuildEnvironment is hidden at home', async () => {
const buildInfo = useAppConfig().buildInfo
const component = await mountSuspended(AppFooter, {
route: '/',
})
const envSpan = component.find('span.tracking-wider')
expect(envSpan.exists()).toBe(false)
const commitLink = component.find(`a[href$="/commit/${buildInfo.commit}"]`)
expect(commitLink.exists()).toBe(false)
const tagLink = component.find(`a[href$="/tag/v${buildInfo.commit}"]`)
expect(tagLink.exists()).toBe(false)
})
})