github.com/btccom/go-micro/v2@v2.9.3/api/router/registry/registry_test.go (about) 1 package registry 2 3 import ( 4 "testing" 5 6 "github.com/btccom/go-micro/v2/registry" 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestStoreRegex(t *testing.T) { 11 router := newRouter() 12 router.store([]*registry.Service{ 13 { 14 Name: "Foobar", 15 Version: "latest", 16 Endpoints: []*registry.Endpoint{ 17 { 18 Name: "foo", 19 Metadata: map[string]string{ 20 "endpoint": "FooEndpoint", 21 "description": "Some description", 22 "method": "POST", 23 "path": "^/foo/$", 24 "handler": "rpc", 25 }, 26 }, 27 }, 28 Metadata: map[string]string{}, 29 }, 30 }, 31 ) 32 33 assert.Len(t, router.ceps["Foobar.foo"].pcreregs, 1) 34 }