45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
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)
|
|
})
|
|
})
|