add frontend

This commit is contained in:
voltsrage
2026-06-19 17:42:09 +08:00
parent 49973271e5
commit 5f69ce1a95
53 changed files with 6591 additions and 0 deletions
@@ -0,0 +1,37 @@
import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import AlertCard from '@/components/alerts/AlertCard.vue'
const openAlert = {
id: 'alert-1',
alertType: 'SepsisWarning',
severity: 'Critical',
status: 'Open',
details: 'SIRS criteria met',
triggeredAt: '2026-06-19T12:00:00Z',
}
const resolvedAlert = {
...openAlert,
id: 'alert-2',
status: 'Resolved',
}
describe('AlertCard', () => {
it('showsAlertTypeAndSeverity', () => {
const wrapper = mount(AlertCard, { props: { alert: openAlert } })
expect(wrapper.text()).toContain('Critical')
expect(wrapper.text()).toContain('SEPSIS_WARNING')
})
it('acknowledgeButtonEmitsEvent', async () => {
const wrapper = mount(AlertCard, { props: { alert: openAlert } })
await wrapper.get('button').trigger('click')
expect(wrapper.emitted('acknowledge')).toHaveLength(1)
})
it('resolvedAlertHidesActions', () => {
const wrapper = mount(AlertCard, { props: { alert: resolvedAlert } })
expect(wrapper.findAll('button')).toHaveLength(0)
})
})