Merge pull request #287 from akash-pandey1729/unit_test_extract_search_parameters

This commit is contained in:
Jason Kulatunga 2023-10-21 08:32:55 -07:00 committed by GitHub
commit 8f430f42d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 2 deletions

View File

@ -2,10 +2,11 @@ package database
import (
"encoding/json"
"github.com/stretchr/testify/require"
"os"
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestFhirPatient_ExtractSearchParameters(t *testing.T) {
@ -50,6 +51,25 @@ func TestFhirPatient_ExtractSearchParameters(t *testing.T) {
"534 Erewhon St PleasantVille Vic 3999",
}, testAddress)
var testTelecom []interface{}
err = json.Unmarshal(json.RawMessage(patientModel.Telecom), &testTelecom)
require.NoError(t, err)
require.Equal(t, []interface{}{
map[string]interface{}{"code": "(03) 5555 6473","system": "phone"},
map[string]interface{}{"code": "(03) 3410 5613","system": "phone"},
map[string]interface{}{"code":"(03) 5555 8834","system": "phone"},
}, testTelecom)
var testIdentifier []interface{}
err = json.Unmarshal(json.RawMessage(patientModel.Identifier), &testIdentifier)
require.NoError(t, err)
require.Equal(t, []interface{}{
map[string]interface{}{
"code": "12345",
"system": "urn:oid:1.2.36.146.595.217.0.1",
},
}, testIdentifier)
require.Equal(t, time.Date(1974, 12, 25, 0, 0, 0, 0, time.UTC), *patientModel.Birthdate)
}