porting all github actions from bluesky-social/indigo to tangled CI
at ci 1.2 kB view raw
1package client 2 3import ( 4 "net/url" 5 "testing" 6 7 "github.com/bluesky-social/indigo/atproto/syntax" 8 9 "github.com/stretchr/testify/assert" 10 "github.com/stretchr/testify/require" 11) 12 13func TestParseParams(t *testing.T) { 14 assert := assert.New(t) 15 require := require.New(t) 16 17 { 18 input := map[string]any{ 19 "int": int(-1), 20 "uint32": uint32(32), 21 "str": "hello", 22 "bool": true, 23 "did": syntax.DID("did:web:example.com"), 24 "multiBool": []bool{true, false}, 25 "multiDID": []syntax.DID{syntax.DID("did:web:example.com"), syntax.DID("did:web:other.com")}, 26 } 27 expect := url.Values(map[string][]string{ 28 "int": []string{"-1"}, 29 "uint32": []string{"32"}, 30 "str": []string{"hello"}, 31 "bool": []string{"true"}, 32 "did": []string{"did:web:example.com"}, 33 "multiBool": []string{"true", "false"}, 34 "multiDID": []string{"did:web:example.com", "did:web:other.com"}, 35 }) 36 output, err := ParseParams(input) 37 require.NoError(err) 38 assert.Equal(expect, output) 39 } 40 41 { 42 // unsupported type 43 input := map[string]any{ 44 "map": map[string]int{"a": 123}, 45 } 46 _, err := ParseParams(input) 47 assert.Error(err) 48 } 49 50}