Skip to content

Commit 0362504

Browse files
committed
more unit tests
1 parent 2977668 commit 0362504

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

response/parse_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// response/parse.go
2+
package response
3+
4+
import (
5+
"reflect"
6+
"testing"
7+
)
8+
9+
func Test_parseHeader(t *testing.T) {
10+
type args struct {
11+
header string
12+
}
13+
tests := []struct {
14+
name string
15+
args args
16+
want string
17+
want1 map[string]string
18+
}{
19+
{
20+
name: "testing content type",
21+
args: args{
22+
header: "content-type:application/json;something",
23+
},
24+
want: "application/json",
25+
},
26+
}
27+
for _, tt := range tests {
28+
t.Run(tt.name, func(t *testing.T) {
29+
got, got1 := parseHeader(tt.args.header)
30+
if got != tt.want {
31+
t.Errorf("parseHeader() got = %v, want %v", got, tt.want)
32+
}
33+
if !reflect.DeepEqual(got1, tt.want1) {
34+
t.Errorf("parseHeader() got1 = %v, want %v", got1, tt.want1)
35+
}
36+
})
37+
}
38+
}

0 commit comments

Comments
 (0)