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
@@ -0,0 +1,44 @@
import { describe, it, expect, beforeEach } from 'vitest'
import { mount } from '@vue/test-utils'
import { createPinia, setActivePinia } from 'pinia'
import FeedbackSummary from '@/views/FeedbackSummary.vue'
import { useFeedbackStore } from '@/stores/feedback'
describe('FeedbackSummary', () => {
beforeEach(() => {
localStorage.clear()
setActivePinia(createPinia())
const store = useFeedbackStore()
store.addFeedback('a1', 'SepsisWarning', 'Critical', 'useful')
store.addFeedback('a2', 'SepsisWarning', 'Critical', 'would-act')
store.addFeedback('a3', 'WarningHeartRate', 'Warning', 'false-positive')
})
it('showsAggregateStats', () => {
const wrapper = mount(FeedbackSummary)
expect(wrapper.text()).toContain('Total Ratings')
expect(wrapper.text()).toContain('Useful / Would Act')
expect(wrapper.text()).toContain('False Positive')
expect(wrapper.text()).toContain('67%')
expect(wrapper.text()).toContain('33%')
})
it('showsPerAlertTypeBreakdown', () => {
const wrapper = mount(FeedbackSummary)
expect(wrapper.text()).toContain('SEPSIS_WARNING')
expect(wrapper.text()).toContain('WARNING_HEART_RATE')
expect(wrapper.text()).toContain('2 ratings')
expect(wrapper.text()).toContain('1 ratings')
})
it('exportButtonsExist', () => {
const wrapper = mount(FeedbackSummary)
const buttons = wrapper.findAll('button')
expect(buttons.some(b => b.text().includes('Export JSON'))).toBe(true)
expect(buttons.some(b => b.text().includes('Export CSV'))).toBe(true)
})
})