move test
Some checks failed
lint / lint (pull_request) Has been cancelled
pr / test (pull_request) Has been cancelled

This commit is contained in:
Денис Евстигнеев 2024-02-29 18:02:12 +03:00
parent 4124b49481
commit e212e3dc50
2 changed files with 36 additions and 1 deletions

View File

@ -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)
}
})
}
}

View File

@ -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,
},