-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrequest_test.go
More file actions
44 lines (41 loc) · 809 Bytes
/
request_test.go
File metadata and controls
44 lines (41 loc) · 809 Bytes
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
36
37
38
39
40
41
42
43
44
package fans
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestM_Param(t *testing.T) {
tests := []struct {
name string
body M
want string
}{
{"test case", M{
"id": "114514",
"str": "1919810",
"test": "いいよ,こいよ",
}, "id=114514&str=1919810&test=%E3%81%84%E3%81%84%E3%82%88%EF%BC%8C%E3%81%93%E3%81%84%E3%82%88"},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
assert.Equal(t, test.want, test.body.Param())
})
}
}
func TestES_Map(t *testing.T) {
want := M{
"str": "test",
"emptyStr": "",
"int": 0,
"boolTrue": true,
"boolFalse": false,
}
src := ES{
{"str", "test"},
{"emptyStr", ""},
{"int", 0},
{"boolTrue", true},
{"boolFalse", false},
}
r := src.Map()
assert.Equal(t, want, r)
}