fixtures

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

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

func EnvelopeFromJSON(t *testing.T, resourceType string, data []byte) *types.ResourceEnvelope

EnvelopeFromJSON parses FHIR JSON through types.JSONCodec and returns a normalized envelope.

func EnvelopeFromProtoJSON

func EnvelopeFromProtoJSON(t *testing.T, resourceType string, data []byte) *types.ResourceEnvelope

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL