fix:
No SOFA trend chart or organ-system timeline No GCS trend chart or component history No qSOFA history view
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import GcsHistory from '@/components/charts/GcsHistory.vue'
|
||||
|
||||
vi.mock('vue-chartjs', () => ({
|
||||
Line: {
|
||||
name: 'Line',
|
||||
template: '<div class="mock-chart" />',
|
||||
props: ['data', 'options'],
|
||||
},
|
||||
}))
|
||||
|
||||
describe('GcsHistory', () => {
|
||||
beforeEach(() => {
|
||||
window.matchMedia = vi.fn().mockReturnValue({ matches: false })
|
||||
})
|
||||
|
||||
const history = [
|
||||
{
|
||||
eyeScore: 4,
|
||||
verbalScore: 5,
|
||||
motorScore: 6,
|
||||
totalScore: 15,
|
||||
classification: 'MILD',
|
||||
calculatedAt: '2026-06-23T10:00:00Z',
|
||||
},
|
||||
{
|
||||
eyeScore: 2,
|
||||
verbalScore: 3,
|
||||
motorScore: 3,
|
||||
totalScore: 8,
|
||||
classification: 'SEVERE',
|
||||
calculatedAt: '2026-06-23T14:00:00Z',
|
||||
},
|
||||
]
|
||||
|
||||
it('rendersTitleAndChart', () => {
|
||||
const wrapper = mount(GcsHistory, { props: { history } })
|
||||
expect(wrapper.text()).toContain('GCS Over Time')
|
||||
expect(wrapper.find('.mock-chart').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('sortsHistoryChronologically', () => {
|
||||
const wrapper = mount(GcsHistory, { props: { history: [...history].reverse() } })
|
||||
const chart = wrapper.findComponent({ name: 'Line' })
|
||||
const totals = chart.props('data').datasets.find(d => d.label === 'GCS Total').data
|
||||
expect(totals).toEqual([15, 8])
|
||||
})
|
||||
|
||||
it('includesComponentDatasets', () => {
|
||||
const wrapper = mount(GcsHistory, { props: { history } })
|
||||
const chart = wrapper.findComponent({ name: 'Line' })
|
||||
const labels = chart.props('data').datasets.map(d => d.label)
|
||||
expect(labels).toContain('Eye')
|
||||
expect(labels).toContain('Verbal')
|
||||
expect(labels).toContain('Motor')
|
||||
expect(labels).toContain('GCS Total')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,52 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import QsofaHistory from '@/components/charts/QsofaHistory.vue'
|
||||
|
||||
vi.mock('vue-chartjs', () => ({
|
||||
Line: {
|
||||
name: 'Line',
|
||||
template: '<div class="mock-chart" />',
|
||||
props: ['data', 'options'],
|
||||
},
|
||||
}))
|
||||
|
||||
describe('QsofaHistory', () => {
|
||||
beforeEach(() => {
|
||||
window.matchMedia = vi.fn().mockReturnValue({ matches: false })
|
||||
})
|
||||
|
||||
const history = [
|
||||
{
|
||||
activeCriteria: 1,
|
||||
criteria: { respRate: 24, systolicBp: null, avpu: null },
|
||||
screenAlertFired: false,
|
||||
evaluatedAt: '2026-06-23T10:00:00Z',
|
||||
},
|
||||
{
|
||||
activeCriteria: 2,
|
||||
criteria: { respRate: 24, systolicBp: 95, avpu: null },
|
||||
screenAlertFired: true,
|
||||
evaluatedAt: '2026-06-23T14:00:00Z',
|
||||
},
|
||||
]
|
||||
|
||||
it('rendersTitleAndChart', () => {
|
||||
const wrapper = mount(QsofaHistory, { props: { history } })
|
||||
expect(wrapper.text()).toContain('qSOFA Screen Over Time')
|
||||
expect(wrapper.find('.mock-chart').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('sortsHistoryChronologically', () => {
|
||||
const wrapper = mount(QsofaHistory, { props: { history: [...history].reverse() } })
|
||||
const chart = wrapper.findComponent({ name: 'Line' })
|
||||
const counts = chart.props('data').datasets.find(d => d.label === 'Active criteria').data
|
||||
expect(counts).toEqual([1, 2])
|
||||
})
|
||||
|
||||
it('marksAlertFiredPoints', () => {
|
||||
const wrapper = mount(QsofaHistory, { props: { history } })
|
||||
const chart = wrapper.findComponent({ name: 'Line' })
|
||||
const total = chart.props('data').datasets.find(d => d.label === 'Active criteria')
|
||||
expect(total.pointStyle).toEqual(['circle', 'star'])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,61 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import SofaHistory from '@/components/charts/SofaHistory.vue'
|
||||
|
||||
vi.mock('vue-chartjs', () => ({
|
||||
Chart: {
|
||||
name: 'Chart',
|
||||
template: '<div class="mock-chart" />',
|
||||
props: ['type', 'data', 'options'],
|
||||
},
|
||||
}))
|
||||
|
||||
describe('SofaHistory', () => {
|
||||
beforeEach(() => {
|
||||
window.matchMedia = vi.fn().mockReturnValue({ matches: false })
|
||||
})
|
||||
const history = [
|
||||
{
|
||||
totalScore: 4,
|
||||
respiratoryScore: 1,
|
||||
coagulationScore: 1,
|
||||
liverScore: 0,
|
||||
cardiovascularScore: 1,
|
||||
cnsScore: 1,
|
||||
renalScore: 0,
|
||||
calculatedAt: '2026-06-23T10:00:00Z',
|
||||
},
|
||||
{
|
||||
totalScore: 8,
|
||||
respiratoryScore: 2,
|
||||
coagulationScore: 1,
|
||||
liverScore: 1,
|
||||
cardiovascularScore: 2,
|
||||
cnsScore: 1,
|
||||
renalScore: 1,
|
||||
calculatedAt: '2026-06-23T14:00:00Z',
|
||||
},
|
||||
]
|
||||
|
||||
it('rendersTitleAndChart', () => {
|
||||
const wrapper = mount(SofaHistory, { props: { history } })
|
||||
expect(wrapper.text()).toContain('SOFA Score Over Time')
|
||||
expect(wrapper.find('.mock-chart').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('sortsHistoryChronologically', () => {
|
||||
const wrapper = mount(SofaHistory, { props: { history: [...history].reverse() } })
|
||||
const chart = wrapper.findComponent({ name: 'Chart' })
|
||||
const totals = chart.props('data').datasets.find(d => d.label === 'SOFA Total').data
|
||||
expect(totals).toEqual([4, 8])
|
||||
})
|
||||
|
||||
it('includesOrganSystemDatasets', () => {
|
||||
const wrapper = mount(SofaHistory, { props: { history } })
|
||||
const chart = wrapper.findComponent({ name: 'Chart' })
|
||||
const labels = chart.props('data').datasets.map(d => d.label)
|
||||
expect(labels).toContain('Respiratory')
|
||||
expect(labels).toContain('Renal')
|
||||
expect(labels).toContain('SOFA Total')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user