Unverified Commit 477a77ec authored by Hanzei's avatar Hanzei Committed by GitHub
Browse files

Add more tests for conversions.go (#47)

parent 1a077bf3
package objx_test
import (
"net/url"
"testing"
"github.com/stretchr/objx"
......@@ -77,3 +78,19 @@ func TestConversionSignedBase64WithError(t *testing.T) {
assert.Error(t, err)
}
func TestConversionURLValues(t *testing.T) {
m := objx.Map{"abc": 123, "name": "Mat"}
u := m.URLValues()
assert.Equal(t, url.Values{"abc": []string{"123"}, "name": []string{"Mat"}}, u)
}
func TestConversionURLQuery(t *testing.T) {
m := objx.Map{"abc": 123, "name": "Mat"}
u, err := m.URLQuery()
assert.Nil(t, err)
require.NotNil(t, u)
assert.Equal(t, "abc=123&name=Mat", u)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment