68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
import { describe, it, expect, vi } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import HandoffReport from '@/components/ward/HandoffReport.vue'
|
|
|
|
const mockReport = {
|
|
generatedAt: '2026-06-23T08:00:00Z',
|
|
generatedBy: 'Test Nurse',
|
|
summary: {
|
|
department: 'ICU',
|
|
patientCount: 1,
|
|
criticalCount: 1,
|
|
alertCount: 2,
|
|
activeBundles: 1,
|
|
},
|
|
patients: [
|
|
{
|
|
encounterId: 'enc-1',
|
|
name: 'Jane Doe',
|
|
mrn: 'MRN001',
|
|
room: 'ICU-3',
|
|
department: 'ICU',
|
|
attending: 'Dr Smith',
|
|
news2: 8,
|
|
sofa: 6,
|
|
sofaDelta: 2,
|
|
gcs: 14,
|
|
qsofa: 2,
|
|
vitalsSummary: 'HR 110 bpm',
|
|
alertsSummary: 'NEWS2 Emergency',
|
|
pendingOrders: 'Blood cultures',
|
|
sbar: {
|
|
situation: 'Sepsis workup',
|
|
background: 'Allergies: Penicillin',
|
|
assessment: 'NEWS2 8',
|
|
recommendation: 'Blood cultures',
|
|
},
|
|
},
|
|
],
|
|
}
|
|
|
|
vi.mock('@/composables/handoffReport', async importOriginal => {
|
|
const actual = await importOriginal()
|
|
return {
|
|
...actual,
|
|
buildHandoffReport: vi.fn(() => Promise.resolve(mockReport)),
|
|
}
|
|
})
|
|
|
|
describe('HandoffReport', () => {
|
|
it('rendersWardSummaryAndPatientRows', async () => {
|
|
const wrapper = mount(HandoffReport, {
|
|
props: {
|
|
encounters: [{ encounterId: 'enc-1' }],
|
|
department: 'ICU',
|
|
generatedBy: 'Test Nurse',
|
|
},
|
|
attachTo: document.body,
|
|
})
|
|
|
|
await vi.waitFor(() => expect(document.body.textContent).toContain('Ward Summary'))
|
|
expect(document.body.textContent).toContain('Jane Doe')
|
|
expect(document.body.textContent).toContain('SBAR')
|
|
expect(document.body.textContent).toContain('Sepsis workup')
|
|
wrapper.unmount()
|
|
document.body.innerHTML = ''
|
|
})
|
|
})
|