Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmcguire1 committed Jul 4, 2024
1 parent f4f0b3b commit 32d9948
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions moderation.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ type SendModeratorWarnChatMessageParams struct {
// The ID of the broadcaster whose chat room the message will be sent to
BroadcasterID string `query:"broadcaster_id"`

// The ID of the twitch user who requested the warning.
ModeratorID string `query:"moderator_id"`

// The ID of the user sent the WARN message
Expand Down
26 changes: 24 additions & 2 deletions moderation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1141,16 +1141,38 @@ func TestSendModeratorWarnMessage(t *testing.T) {
"",
},
{
http.StatusUnauthorized,
http.StatusOK,
&Options{ClientID: "my-client-id", UserAccessToken: "invalid-access-token"},
&SendModeratorWarnChatMessageParams{
BroadcasterID: "1234",
ModeratorID: "5678",
Reason: "Test warning message",
},
`{"error":"Unauthorized","status":401,"message":"Invalid OAuth token"}`,
"",
"error: user id must be specified",
},
{
http.StatusOK,
&Options{ClientID: "my-client-id", UserAccessToken: "invalid-access-token"},
&SendModeratorWarnChatMessageParams{
UserID: "1234",
ModeratorID: "5678",
Reason: "Test warning message",
},
"",
"error: broadcaster id must be specified",
},
{
http.StatusOK,
&Options{ClientID: "my-client-id", UserAccessToken: "invalid-access-token"},
&SendModeratorWarnChatMessageParams{
UserID: "1234",
BroadcasterID: "12345",
Reason: "Test warning message",
},
"",
"error: moderator id must be specified",
},
{
http.StatusUnauthorized,
&Options{ClientID: "my-client-id", UserAccessToken: "invalid-access-token"},
Expand Down

0 comments on commit 32d9948

Please sign in to comment.