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,26 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { describe, it, expect } from 'vitest'
|
||||
|
||||
import QueueStatusBar from '../../src/components/settings/QueueStatusBar.vue'
|
||||
import { useSystemActivityStore } from '../../src/stores/systemActivity.js'
|
||||
import { freshPinia, mountComponent } from '../support/mountComponent.js'
|
||||
|
||||
describe('QueueStatusBar', () => {
|
||||
it('shows the pending count when the queue is busy', () => {
|
||||
const pinia = freshPinia()
|
||||
useSystemActivityStore().queues = { queues: { ml: 3 }, fetched_at: '' }
|
||||
const w = mountComponent(QueueStatusBar, {
|
||||
props: { queue: 'ml', queueLabel: 'ML' }, pinia,
|
||||
})
|
||||
expect(w.text()).toContain('3 pending')
|
||||
})
|
||||
|
||||
it('reads idle when the queue is empty', () => {
|
||||
const pinia = freshPinia()
|
||||
useSystemActivityStore().queues = { queues: { ml: 0 }, fetched_at: '' }
|
||||
const w = mountComponent(QueueStatusBar, {
|
||||
props: { queue: 'ml', queueLabel: 'ML' }, pinia,
|
||||
})
|
||||
expect(w.text().toLowerCase()).toContain('idle')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user