Skip to content

Commit

Permalink
Add more tests for conversions.go (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzei committed Jan 25, 2018
1 parent 1a077bf commit 477a77e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions conversions_test.go
@@ -1,6 +1,7 @@
package objx_test

import (
"net/url"
"testing"

"github.com/stretchr/objx"
Expand Down Expand Up @@ -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)
}

0 comments on commit 477a77e

Please sign in to comment.