Files
bvandeusen 44410db492 test(I2): vitest component smoke tests for high-risk UI
Adds @vue/test-utils + happy-dom and mounts CredentialCard, DownloadEventRow,
PostCard, ActiveDownloadsPanel, QueueStatusBar, asserting they render without
throwing and surface key content — catching the dead-binding / render-error
class (e.g. the last_verified_at regression, guarded explicitly). Vuetify
components are left unresolved (Vue renders unknown elements + slots), so no
Vuetify-plugin setup is needed; only RouterLink is stubbed. Per-file
happy-dom env via docblock keeps the existing node-env specs untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 12:34:58 -04:00

25 lines
782 B
JavaScript

import { mount } from '@vue/test-utils'
import { createPinia, setActivePinia } from 'pinia'
// Smoke-test helper. Vuetify components are left unresolved (Vue 3 renders
// unknown elements with their slot children, so text content is still
// present and nothing throws), which avoids standing up the whole Vuetify
// plugin in happy-dom. RouterLink is the one import that needs a router, so
// it's stubbed with a slot-rendering anchor.
export function freshPinia () {
const pinia = createPinia()
setActivePinia(pinia)
return pinia
}
export function mountComponent (Component, { props = {}, pinia } = {}) {
return mount(Component, {
props,
global: {
plugins: pinia ? [pinia] : [],
stubs: { RouterLink: { template: '<a><slot /></a>' } },
},
})
}