Skip to content

Commit

Permalink
Merge pull request #287 from akash-pandey1729/unit_test_extract_searc…
Browse files Browse the repository at this point in the history
…h_parameters
  • Loading branch information
AnalogJ committed Oct 21, 2023
2 parents 6f4067d + b212e97 commit 8f430f4
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions backend/pkg/models/database/fhir_patient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)

}
}

0 comments on commit 8f430f4

Please sign in to comment.