feature: Doctor Feedback Mode

This commit is contained in:
voltsrage
2026-06-20 14:32:51 +08:00
parent ebd53f2df6
commit 584d1edd58
17 changed files with 1385 additions and 11 deletions
@@ -1,5 +1,6 @@
import { describe, it, expect } from 'vitest'
import { describe, it, expect, beforeEach } from 'vitest'
import { mount } from '@vue/test-utils'
import { createPinia, setActivePinia } from 'pinia'
import AlertCard from '@/components/alerts/AlertCard.vue'
const openAlert = {
@@ -18,6 +19,10 @@ const resolvedAlert = {
}
describe('AlertCard', () => {
beforeEach(() => {
setActivePinia(createPinia())
})
it('showsAlertTypeAndSeverity', () => {
const wrapper = mount(AlertCard, { props: { alert: openAlert } })
expect(wrapper.text()).toContain('Critical')
@@ -26,12 +31,15 @@ describe('AlertCard', () => {
it('acknowledgeButtonEmitsEvent', async () => {
const wrapper = mount(AlertCard, { props: { alert: openAlert } })
await wrapper.get('button').trigger('click')
const ackButton = wrapper.findAll('button').find(b => b.text() === 'Acknowledge')
await ackButton.trigger('click')
expect(wrapper.emitted('acknowledge')).toHaveLength(1)
})
it('resolvedAlertHidesActions', () => {
const wrapper = mount(AlertCard, { props: { alert: resolvedAlert } })
expect(wrapper.findAll('button')).toHaveLength(0)
const actionButtons = wrapper.findAll('button').filter(b => ['Acknowledge', 'Resolve'].includes(b.text()))
expect(actionButtons).toHaveLength(0)
expect(wrapper.text()).toContain('Useful')
})
})