blob: 4a07b00f5fdc7a0ea89a9958185e80d3b2b1a06d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package validator
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())
}
|