-
Notifications
You must be signed in to change notification settings - Fork 7
/
labtests_test.go
52 lines (46 loc) · 1.09 KB
/
labtests_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package infermedica
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestApp_LabTests(t *testing.T) {
a := GetTestAppInstance()
res, err := a.LabTests()
assert.NoError(t, err)
assert.NotEqual(t, len(*res), 0)
assert.NotEmpty(t, (*res)[0].ID)
assert.NotEmpty(t, (*res)[0].Name)
assert.NotEmpty(t, (*res)[0].CommonName)
testLabTestByID(a, (*res)[0], t)
}
func testLabTestByID(a App, r LabTestsRes, t *testing.T) {
res, err := a.LabTestByID(r.ID)
assert.NoError(t, err)
assert.Equal(t, res.Name, r.Name)
assert.Equal(t, res.CommonName, r.CommonName)
}
func TestApp_LabTestsRecommend(t *testing.T) {
a := GetTestAppInstance()
r := DiagnosisReq{
Sex: SexMale,
Age: 30,
Evidences: []Evidence{
Evidence{
ID: "s_1193",
ChoiceID: EvidenceChoiceIDPresent,
},
Evidence{
ID: "s_488",
ChoiceID: EvidenceChoiceIDPresent,
},
Evidence{
ID: "s_418",
ChoiceID: EvidenceChoiceIDPresent,
},
},
}
res, err := a.LabTestsRecommend(r)
assert.NoError(t, err)
assert.NotEmpty(t, res.Recommended)
assert.NotEmpty(t, res.Obligatory)
}