This commit is contained in:
Bel LaPointe
2024-02-20 11:35:11 -07:00
parent ce1c1e0205
commit 74830411d0
3 changed files with 60 additions and 7 deletions

View File

@@ -79,10 +79,10 @@ func TestRunHTTP(t *testing.T) {
if w.Code != http.StatusOK {
t.Error(w.Code)
}
var result []string
var result []Question
if err := json.Unmarshal(w.Body.Bytes(), &result); err != nil {
t.Error(err)
} else if fmt.Sprint(result) != fmt.Sprint([]string{"0"}) {
} else if fmt.Sprint(result) != fmt.Sprint([]Question{{ID: "0", Live: false, Closed: false, Text: "QUESTION TEXT", Options: []string{"X", "Y"}}}) {
t.Error(result)
}
})
@@ -100,7 +100,7 @@ func TestRunHTTP(t *testing.T) {
var result Question
if err := json.Unmarshal(w.Body.Bytes(), &result); err != nil {
t.Error(err)
} else if fmt.Sprint(result) != fmt.Sprint(Question{Text: "QUESTION TEXT", Options: []string{"X", "Y"}}) {
} else if fmt.Sprint(result) != fmt.Sprint(Question{ID: "0", Text: "QUESTION TEXT", Options: []string{"X", "Y"}}) {
t.Error(result)
}
})