import { describe, it, expect } from 'vitest'
import {
  formatTimelineEvent,
  timelineTypeLabel,
  TIMELINE_EVENT_TYPES,
} from '@/composables/timelineFormat'

describe('timelineFormat', () => {
  it('formatsObservationEvent', () => {
    const text = formatTimelineEvent({
      type: 'observation',
      observationCode: 'HEART_RATE',
      value: 110,
      unit: 'bpm',
    })
    expect(text).toContain('Heart Rate')
    expect(text).toContain('110')
  })

  it('formatsMedicationEvent', () => {
    const text = formatTimelineEvent({
      type: 'medication',
      drugName: 'Metoprolol',
      dose: 5,
      doseUnit: 'mg',
      route: 'IV',
    })
    expect(text).toBe('Metoprolol 5mg (IV)')
  })

  it('listsAllEventTypes', () => {
    expect(TIMELINE_EVENT_TYPES.map(t => t.id)).toEqual([
      'observation',
      'alert',
      'order',
      'medication',
      'status',
    ])
    expect(timelineTypeLabel('order')).toBe('Orders')
  })
})
