From 477a77ecc69700c7cdeb1fa9e129548e1c1c393c Mon Sep 17 00:00:00 2001 From: Hanzei Date: Thu, 25 Jan 2018 23:19:50 +0100 Subject: [PATCH] Add more tests for conversions.go (#47) --- conversions_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/conversions_test.go b/conversions_test.go index f221c14..4584208 100644 --- a/conversions_test.go +++ b/conversions_test.go @@ -1,6 +1,7 @@ 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) +}