unit test for identifier and telecom for example1
This commit is contained in:
parent
6f4067d179
commit
79a5c20d06
|
@ -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,37 @@ 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)
|
||||
telecom_1 := map[string]interface{}{
|
||||
"code": "(03) 5555 6473",
|
||||
"system": "phone",
|
||||
}
|
||||
telecom_2 := map[string]interface{}{
|
||||
"code": "(03) 3410 5613",
|
||||
"system": "phone",
|
||||
}
|
||||
telecom_3 := map[string]interface{}{
|
||||
"code":"(03) 5555 8834",
|
||||
"system": "phone",
|
||||
}
|
||||
require.Equal(t, []interface{}{
|
||||
telecom_1,
|
||||
telecom_2,
|
||||
telecom_3,
|
||||
}, 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)
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue