diff options
Diffstat (limited to 'plugins/broadcast/websockets/access_validator_test.go')
-rw-r--r-- | plugins/broadcast/websockets/access_validator_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/broadcast/websockets/access_validator_test.go b/plugins/broadcast/websockets/access_validator_test.go new file mode 100644 index 00000000..41372727 --- /dev/null +++ b/plugins/broadcast/websockets/access_validator_test.go @@ -0,0 +1,35 @@ +package websockets + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestResponseWrapper_Body(t *testing.T) { + w := newValidator() + _, _ =w.Write([]byte("hello")) + + assert.Equal(t, []byte("hello"), w.Body()) +} + +func TestResponseWrapper_Header(t *testing.T) { + w := newValidator() + w.Header().Set("k", "value") + + assert.Equal(t, "value", w.Header().Get("k")) +} + +func TestResponseWrapper_StatusCode(t *testing.T) { + w := newValidator() + w.WriteHeader(200) + + assert.True(t, w.IsOK()) +} + +func TestResponseWrapper_StatusCodeBad(t *testing.T) { + w := newValidator() + w.WriteHeader(400) + + assert.False(t, w.IsOK()) +} |