diff --git a/register/memory/memory_test.go b/register/memory/memory_test.go index 17923ab0..a5dfb52c 100644 --- a/register/memory/memory_test.go +++ b/register/memory/memory_test.go @@ -3,7 +3,9 @@ package memory import ( "context" "fmt" + "go.unistack.org/micro/v4" "go.unistack.org/micro/v4/register" + "reflect" "sync" "testing" "time" @@ -321,3 +323,36 @@ func TestWatcher(t *testing.T) { t.Fatal("expected error on Next()") } } + +func Test_service_Register(t *testing.T) { + r := NewRegister() + + type args struct { + names []string + } + tests := []struct { + name string + opts []micro.Option + args args + want register.Register + }{ + { + name: "service.Register", + opts: []micro.Option{micro.Register(r)}, + args: args{ + names: []string{"memory"}, + }, + want: r, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := micro.NewService(tt.opts...) + + if got := s.Register(tt.args.names...); !reflect.DeepEqual(got, tt.want) { + t.Errorf("service.Register() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/service_test.go b/service_test.go index f5a03f80..08a676fe 100644 --- a/service_test.go +++ b/service_test.go @@ -445,7 +445,7 @@ func Test_service_Register(t *testing.T) { opts: Options{Registers: []register.Register{r}}, }, args: args{ - names: []string{"noop"}, + names: []string{"memory"}, }, want: r, },