This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import { mountSuspended, registerEndpoint } from '@nuxt/test-utils/runtime'
|
||||
import Poi from '../../app/pages/poi.vue'
|
||||
|
||||
describe('poi page', () => {
|
||||
it('renders POI placement heading', async () => {
|
||||
beforeEach(() => {
|
||||
registerEndpoint('/api/pois', () => [])
|
||||
registerEndpoint('/api/me', () => null, { method: 'GET' })
|
||||
const wrapper = await mountSuspended(Poi)
|
||||
expect(wrapper.text()).toContain('POI placement')
|
||||
})
|
||||
|
||||
it('shows view-only message when cannot edit', async () => {
|
||||
registerEndpoint('/api/pois', () => [])
|
||||
registerEndpoint('/api/me', () => null, { method: 'GET' })
|
||||
it.each([
|
||||
['POI placement heading', 'POI placement'],
|
||||
['view-only message', /View-only|Sign in as admin/],
|
||||
])('renders %s', async (description, expected) => {
|
||||
const wrapper = await mountSuspended(Poi)
|
||||
expect(wrapper.text()).toMatch(/View-only|Sign in as admin/)
|
||||
expect(wrapper.text()).toMatch(expected)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user