update FhirPatient unit tests for most fields (#301)

Co-authored-by: Jason Kulatunga <jason@thesparktree.com>
This commit is contained in:
Akash Sampurnanand Pandey 2023-11-13 13:43:03 -05:00 committed by GitHub
parent a71c690241
commit 7c8a118f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 2 deletions

View File

@ -70,6 +70,46 @@ func TestFhirPatient_ExtractSearchParameters(t *testing.T) {
}, },
}, testIdentifier) }, testIdentifier)
var testGender []interface{}
err = json.Unmarshal(json.RawMessage(patientModel.Gender), &testGender)
require.NoError(t, err)
require.Equal(t, []interface{}{
map[string]interface{}{"code": "male"},
}, testGender)
// TODO: Fix the Goja query issues for handling the deceasedBoolean field and them uncomment this unit test
// var testDeceased []interface{}
// err = json.Unmarshal(json.RawMessage(patientModel.Deceased), &testDeceased)
// require.NoError(t, err)
// require.Equal(t, []interface{}{
// map[string]interface{}{"code": true},
// }, testDeceased)
var testfamily []string
err = json.Unmarshal(json.RawMessage(patientModel.Family), &testfamily)
require.NoError(t, err)
require.Equal(t, []string{
"Chalmers", "Windsor",
}, testfamily)
var testPhonetic []string
err = json.Unmarshal(json.RawMessage(patientModel.Phonetic), &testPhonetic)
require.NoError(t, err)
require.Equal(t, []string{
"Peter James Chalmers","Jim", "Peter James Windsor",
}, testPhonetic)
var testOrganisation []interface{}
err = json.Unmarshal(json.RawMessage(patientModel.Organization), &testOrganisation)
require.NoError(t, err)
require.Equal(t, []interface{}{
map[string]interface{}{
"reference": "Organization/1",
"__path__": "Patient.managingOrganization",
},
}, testOrganisation)
require.Equal(t, time.Date(1974, 12, 25, 0, 0, 0, 0, time.UTC), *patientModel.Birthdate) require.Equal(t, time.Date(1974, 12, 25, 0, 0, 0, 0, time.UTC), *patientModel.Birthdate)
} }

View File

@ -81,7 +81,7 @@
} }
] ]
}, },
"deceasedBoolean": false, "deceasedBoolean": true,
"address": [ "address": [
{ {
"use": "home", "use": "home",