Skip to content

Commit 477a77e

Browse files
authored
Add more tests for conversions.go (#47)
1 parent 1a077bf commit 477a77e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

conversions_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package objx_test
22

33
import (
4+
"net/url"
45
"testing"
56

67
"github.com/stretchr/objx"
@@ -77,3 +78,19 @@ func TestConversionSignedBase64WithError(t *testing.T) {
7778

7879
assert.Error(t, err)
7980
}
81+
82+
func TestConversionURLValues(t *testing.T) {
83+
m := objx.Map{"abc": 123, "name": "Mat"}
84+
u := m.URLValues()
85+
86+
assert.Equal(t, url.Values{"abc": []string{"123"}, "name": []string{"Mat"}}, u)
87+
}
88+
89+
func TestConversionURLQuery(t *testing.T) {
90+
m := objx.Map{"abc": 123, "name": "Mat"}
91+
u, err := m.URLQuery()
92+
93+
assert.Nil(t, err)
94+
require.NotNil(t, u)
95+
assert.Equal(t, "abc=123&name=Mat", u)
96+
}

0 commit comments

Comments
 (0)