Skip to content

Commit

Permalink
Adds tests for String method for MessageType
Browse files Browse the repository at this point in the history
  • Loading branch information
ksysoev committed Nov 13, 2023
1 parent 9bb85c0 commit 067f56b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions pkg/ws/ws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,34 @@ func TestHandleError(t *testing.T) {
t.Errorf("Expected empty string, but got %v", buf.String())
}
}
func TestMessageTypeString(t *testing.T) {
tests := []struct {

Check failure on line 169 in pkg/ws/ws_test.go

View workflow job for this annotation

GitHub Actions / tests

fieldalignment: struct with 32 pointer bytes could be 24 (govet)
name string
mt MessageType
want string
}{
{
name: "Request",
mt: Request,
want: "Request",
},
{
name: "Response",
mt: Response,
want: "Response",
},
{
name: "Not defined",
mt: MessageType(42),
want: "Not defined",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.mt.String(); got != tt.want {
t.Errorf("MessageType.String() = %v, want %v", got, tt.want)
}
})
}
}

0 comments on commit 067f56b

Please sign in to comment.