test: update

This commit is contained in:
Benjamin Canac
2024-03-06 15:37:41 +01:00
parent d69817a128
commit d95556ebda
5 changed files with 54 additions and 24 deletions

19
test/component-render.ts Normal file
View File

@@ -0,0 +1,19 @@
import { mountSuspended } from '@nuxt/test-utils/runtime'
import path from 'path'
export default async function (nameOrHtml: string, options: any, component: any) {
let html: string
const name = path.parse(component.__file).name
if (options === undefined) {
const app = {
template: nameOrHtml,
components: { [`U${name}`]: component }
}
const result = await mountSuspended(app)
html = result.html()
} else {
const cResult = await mountSuspended(component, options)
html = cResult.html()
}
return html
}