mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-22 01:05:55 +00:00
27 lines
721 B
TypeScript
27 lines
721 B
TypeScript
import { mountSuspended } from '@nuxt/test-utils/runtime'
|
|
import { flushPromises } from '@vue/test-utils'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
import { Suspense } from 'vue'
|
|
import { createIslandPage } from '~/packages/nuxt/src/components/runtime/server-component'
|
|
|
|
vi.mock('#app/composables/error', async (og) => {
|
|
return {
|
|
...(await og()),
|
|
showError: vi.fn(),
|
|
}
|
|
})
|
|
|
|
describe('Island pages', () => {
|
|
it('expect to show error', async () => {
|
|
await mountSuspended({
|
|
setup () {
|
|
return () => h(Suspense, {}, {
|
|
default: () => h(createIslandPage('pagedontexist')),
|
|
})
|
|
},
|
|
})
|
|
await flushPromises()
|
|
expect(showError).toHaveBeenCalledOnce()
|
|
})
|
|
})
|