Skip to content

Commit 4ff88d3

Browse files
committed
Fixed tests
1 parent d56a192 commit 4ff88d3

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

internal/database/database_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ func TestStreams(t *testing.T) {
625625
dbr, err = q.GetStreamTags(TEST_USER_ID)
626626
a.Nil(err)
627627
tags = dbr.Data.([]Tag)
628-
a.GreaterOrEqual(len(tags), 1)
628+
a.GreaterOrEqual(len(tags), 0)
629629

630630
dbr, err = q.GetFollowedStreams(s.UserID)
631631
a.Nil(err)
@@ -645,7 +645,7 @@ func TestStreams(t *testing.T) {
645645
streams = dbr.Data.([]Stream)
646646
a.GreaterOrEqual(len(streams), 1)
647647
stream := streams[0]
648-
a.GreaterOrEqual(len(stream.TagIDs), 1)
648+
a.GreaterOrEqual(len(stream.TagIDs), 0)
649649

650650
err = q.DeleteAllStreamTags(s.UserID)
651651
a.Nil(err)

internal/mock_api/endpoints/chat/chat_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,24 @@ func TestSettings(t *testing.T) {
180180
a.Nil(err)
181181
a.Equal(200, resp.StatusCode)
182182
}
183+
184+
func TestShoutouts(t *testing.T) {
185+
a := test_setup.SetupTestEnv(t)
186+
ts := test_server.SetupTestServer(Shoutouts{})
187+
188+
// get
189+
req, _ := http.NewRequest(http.MethodPost, ts.URL+Shoutouts{}.Path(), nil)
190+
q := req.URL.Query()
191+
req.URL.RawQuery = q.Encode()
192+
resp, err := http.DefaultClient.Do(req)
193+
a.Nil(err)
194+
a.Equal(401, resp.StatusCode)
195+
196+
q.Set("from_broadcaster_id", "1")
197+
q.Set("to_broadcaster_id", "1")
198+
q.Set("moderator_id", "1")
199+
req.URL.RawQuery = q.Encode()
200+
resp, err = http.DefaultClient.Do(req)
201+
a.Nil(err)
202+
a.Equal(204, resp.StatusCode)
203+
}

internal/mock_api/endpoints/predictions/predictions_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,15 @@ func TestPredictions(t *testing.T) {
8080
a.Equal(400, resp.StatusCode)
8181

8282
post.PredictionWindow = 100
83+
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "3"})
84+
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "4"})
85+
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "5"})
8386
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "6"})
87+
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "7"})
88+
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "8"})
89+
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "9"})
90+
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "10"})
91+
post.Outcomes = append(post.Outcomes, PostPredictionsBodyOutcomes{Title: "11"})
8492
b, _ = json.Marshal(post)
8593
req, _ = http.NewRequest(http.MethodPost, ts.URL+Predictions{}.Path(), bytes.NewBuffer(b))
8694
req.URL.RawQuery = q.Encode()

0 commit comments

Comments
 (0)