Skip to content

Commit

Permalink
update FhirObservation unit tests (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
akash-pandey1729 committed Nov 13, 2023
1 parent 1106d4e commit a71c690
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions backend/pkg/models/database/fhir_observation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package database

import (
"encoding/json"
"github.com/stretchr/testify/require"
"os"
"testing"

"github.com/stretchr/testify/require"
)

func TestFhirObservation_ExtractSearchParameters(t *testing.T) {
Expand Down Expand Up @@ -47,4 +48,25 @@ func TestFhirObservation_ExtractSearchParameters(t *testing.T) {
System: "http://acme.org/devices/clinical-codes",
},
}, testCodeSystem)
}

var testCategory []CodeSystemType
require.NoError(t, err)
err = json.Unmarshal(json.RawMessage(observationModel.Category), &testCategory)
require.NoError(t, err)
require.Equal(t, []CodeSystemType{
{
Code: "vital-signs",
System: "http://terminology.hl7.org/CodeSystem/observation-category",
},
}, testCategory)

var testStatus []interface{}
require.NoError(t, err)
err = json.Unmarshal(json.RawMessage(observationModel.Status), &testStatus)
require.NoError(t, err)
require.Equal(t, []interface{}{
map[string]interface{}{
"code": "final",
},
}, testStatus)
}

0 comments on commit a71c690

Please sign in to comment.