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>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, it, expect } from 'vitest'
|
||||
|
||||
import CredentialCard from '../../src/components/subscriptions/CredentialCard.vue'
|
||||
import { freshPinia, mountComponent } from '../support/mountComponent.js'
|
||||
|
||||
const platform = { key: 'patreon', name: 'Patreon', auth_type: 'cookies' }
|
||||
|
||||
describe('CredentialCard', () => {
|
||||
it('renders the last-verified row when last_verified is set', () => {
|
||||
// Regression guard: the field was once read as last_verified_at, so the
|
||||
// row silently never rendered.
|
||||
const pinia = freshPinia()
|
||||
const recent = new Date(Date.now() - 2 * 86400_000).toISOString()
|
||||
const credential = {
|
||||
platform: 'patreon', credential_type: 'cookies',
|
||||
captured_at: recent, expires_at: null, last_verified: recent,
|
||||
}
|
||||
const w = mountComponent(CredentialCard, { props: { platform, credential }, pinia })
|
||||
expect(w.text()).toContain('Last verified')
|
||||
})
|
||||
|
||||
it('renders the empty state with no credential', () => {
|
||||
const pinia = freshPinia()
|
||||
const w = mountComponent(CredentialCard, { props: { platform, credential: null }, pinia })
|
||||
expect(w.text()).toContain('No credential stored')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user