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,30 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, it, expect } from 'vitest'
|
||||
|
||||
import ActiveDownloadsPanel from '../../src/components/subscriptions/ActiveDownloadsPanel.vue'
|
||||
import { useDownloadsStore } from '../../src/stores/downloads.js'
|
||||
import { freshPinia, mountComponent } from '../support/mountComponent.js'
|
||||
|
||||
describe('ActiveDownloadsPanel', () => {
|
||||
it('lists a running download with its artist', () => {
|
||||
const pinia = freshPinia()
|
||||
useDownloadsStore().activeEvents = [{
|
||||
id: 1, status: 'running',
|
||||
started_at: new Date(Date.now() - 65000).toISOString(),
|
||||
platform: 'patreon', artist_name: 'Alice',
|
||||
}]
|
||||
const w = mountComponent(ActiveDownloadsPanel, { pinia })
|
||||
const t = w.text()
|
||||
expect(t).toContain('Alice')
|
||||
expect(t).toContain('downloading')
|
||||
w.unmount() // clear the 1s elapsed-timer interval
|
||||
})
|
||||
|
||||
it('renders nothing when there is no active work', () => {
|
||||
const pinia = freshPinia()
|
||||
useDownloadsStore().activeEvents = []
|
||||
const w = mountComponent(ActiveDownloadsPanel, { pinia })
|
||||
expect(w.text()).toBe('')
|
||||
w.unmount()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user