Documentation
¶
Overview ¶
Package fixtures provides stable, named FHIR resource presets as normalized *types.ResourceEnvelope values for tests.
All fixtures parse through types.JSONCodec (or proto.GoogleR4Codec via EnvelopeFromProtoJSON) so JSON, Hash, VersionID, and LastUpdated match production envelope conventions.
Named presets:
- PatientJane, PatientJohn, SamplePatient, OfflinePatientCreate
- AppointmentBooked, AppointmentForPatient
- ObservationVitals, ObservationForPatient
Use factories when a test needs to override ids, references, or fields without copying raw JSON blobs.
Index ¶
- func AppointmentBooked(t *testing.T) *types.ResourceEnvelope
- func AppointmentForPatient(t *testing.T, patientID string) *types.ResourceEnvelope
- func EnvelopeFromJSON(t *testing.T, resourceType string, data []byte) *types.ResourceEnvelope
- func EnvelopeFromProtoJSON(t *testing.T, resourceType string, data []byte) *types.ResourceEnvelope
- func MustEnvelopeFromJSON(resourceType string, data []byte) (*types.ResourceEnvelope, error)
- func ObservationForPatient(t *testing.T, patientID string) *types.ResourceEnvelope
- func ObservationVitals(t *testing.T) *types.ResourceEnvelope
- func OfflinePatientCreate(t *testing.T) *types.ResourceEnvelope
- func PatientJane(t *testing.T) *types.ResourceEnvelope
- func PatientJohn(t *testing.T) *types.ResourceEnvelope
- func SamplePatient(t *testing.T, id string) *types.ResourceEnvelope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppointmentBooked ¶
func AppointmentBooked(t *testing.T) *types.ResourceEnvelope
AppointmentBooked returns a booked appointment referencing Patient/pat-jane.
func AppointmentForPatient ¶
func AppointmentForPatient(t *testing.T, patientID string) *types.ResourceEnvelope
AppointmentForPatient returns a booked appointment referencing the given patient id.
func EnvelopeFromJSON ¶
EnvelopeFromJSON parses FHIR JSON through types.JSONCodec and returns a normalized envelope.
func EnvelopeFromProtoJSON ¶
EnvelopeFromProtoJSON parses FHIR JSON through proto.GoogleR4Codec for proto-backed tests.
func MustEnvelopeFromJSON ¶
func MustEnvelopeFromJSON(resourceType string, data []byte) (*types.ResourceEnvelope, error)
MustEnvelopeFromJSON is like EnvelopeFromJSON but returns an error instead of failing the test.
func ObservationForPatient ¶
func ObservationForPatient(t *testing.T, patientID string) *types.ResourceEnvelope
ObservationForPatient returns a vital-signs observation for the given patient id.
func ObservationVitals ¶
func ObservationVitals(t *testing.T) *types.ResourceEnvelope
ObservationVitals returns an observation referencing Patient/pat-jane.
func OfflinePatientCreate ¶
func OfflinePatientCreate(t *testing.T) *types.ResourceEnvelope
OfflinePatientCreate is a named preset for an offline-created patient.
func PatientJane ¶
func PatientJane(t *testing.T) *types.ResourceEnvelope
PatientJane returns a normalized Patient fixture (Jane Doe).
func PatientJohn ¶
func PatientJohn(t *testing.T) *types.ResourceEnvelope
PatientJohn returns a normalized Patient fixture (John Smith).
func SamplePatient ¶
func SamplePatient(t *testing.T, id string) *types.ResourceEnvelope
SamplePatient returns a minimal Patient envelope with the given id.
Types ¶
This section is empty.