update FhirObservation unit tests (#303)

This commit is contained in:
Akash Sampurnanand Pandey 2023-11-13 13:37:48 -05:00 committed by GitHub
parent 1106d4e869
commit a71c690241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 2 deletions

View File

@ -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) {
@ -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)
}