github.com/msales/pkg/v3@v3.24.0/grpcx/middleware/chain_test.go (about) 1 package middleware_test 2 3 import ( 4 "testing" 5 6 "github.com/msales/pkg/v3/grpcx/middleware" 7 "github.com/stretchr/testify/assert" 8 "google.golang.org/grpc" 9 ) 10 11 func TestWithUnaryClientInterceptors(t *testing.T) { 12 interceptor := middleware.WithUnaryClientInterceptors() 13 14 assert.Implements(t, (*grpc.DialOption)(nil), interceptor) 15 } 16 17 func TestWithStreamClientInterceptors(t *testing.T) { 18 interceptor := middleware.WithStreamClientInterceptors() 19 20 assert.Implements(t, (*grpc.DialOption)(nil), interceptor) 21 } 22 23 func TestWithUnaryServerInterceptors(t *testing.T) { 24 interceptor := middleware.WithUnaryServerInterceptors() 25 _, ok := interceptor.(grpc.ServerOption) 26 27 assert.True(t, ok) 28 } 29 30 func TestWithStreamServerInterceptors(t *testing.T) { 31 interceptor := middleware.WithStreamServerInterceptors() 32 _, ok := interceptor.(grpc.ServerOption) 33 34 assert.True(t, ok) 35 }