feature: Improve dashboard functionality
This commit is contained in:
@@ -68,14 +68,19 @@ const patients = [
|
||||
]
|
||||
|
||||
describe('WardTable', () => {
|
||||
const sortProps = {
|
||||
sortField: 'news2Score',
|
||||
sortDirection: 'desc',
|
||||
}
|
||||
|
||||
it('rendersAllPatientRows', () => {
|
||||
const wrapper = mount(WardTable, { props: { patients } })
|
||||
const wrapper = mount(WardTable, { props: { patients, ...sortProps } })
|
||||
expect(wrapper.findAll('tbody tr')).toHaveLength(3)
|
||||
})
|
||||
|
||||
it('emitsClickWithEncounterId', async () => {
|
||||
mockPush.mockClear()
|
||||
const wrapper = mount(WardTable, { props: { patients } })
|
||||
const wrapper = mount(WardTable, { props: { patients, ...sortProps } })
|
||||
await wrapper.findAll('tbody tr')[2].trigger('click')
|
||||
expect(mockPush).toHaveBeenCalledWith({
|
||||
name: 'PatientDetail',
|
||||
@@ -84,18 +89,26 @@ describe('WardTable', () => {
|
||||
})
|
||||
|
||||
it('showsCriticalBadgeForHighNews2', () => {
|
||||
const wrapper = mount(WardTable, { props: { patients } })
|
||||
const wrapper = mount(WardTable, { props: { patients, ...sortProps } })
|
||||
const highRiskRow = wrapper.findAll('tbody tr')[2]
|
||||
expect(highRiskRow.html()).toContain('text-severity-critical')
|
||||
})
|
||||
|
||||
it('showsExtendedClinicalColumns', () => {
|
||||
const wrapper = mount(WardTable, { props: { patients } })
|
||||
const wrapper = mount(WardTable, { props: { patients, ...sortProps } })
|
||||
const header = wrapper.find('thead').text()
|
||||
expect(header).toContain('SOFA')
|
||||
expect(header).toContain('GCS')
|
||||
expect(header).toContain('Department')
|
||||
expect(header).toContain('Last vitals')
|
||||
expect(wrapper.text()).toContain('Dr. C')
|
||||
expect(wrapper.text()).toContain('Δ+2')
|
||||
})
|
||||
|
||||
it('emitsSortWhenHeaderClicked', async () => {
|
||||
const wrapper = mount(WardTable, { props: { patients, ...sortProps } })
|
||||
const roomHeader = wrapper.findAll('thead button').find(button => button.text().includes('Room'))
|
||||
await roomHeader.trigger('click')
|
||||
expect(wrapper.emitted('sort')).toEqual([['roomBed']])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user