move test
This commit is contained in:
parent
4124b49481
commit
e212e3dc50
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user