diff --git a/conduit/schema/client/client_test.go b/conduit/schema/client/client_test.go new file mode 100644 index 0000000..3be63ec --- /dev/null +++ b/conduit/schema/client/client_test.go @@ -0,0 +1,45 @@ +// Copyright © 2024 Meroxa, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + v1 "github.com/conduitio/conduit-connector-protocol/conduit/schema/v1" + "testing" + + "github.com/conduitio/conduit-connector-protocol/conduit/schema/mock" + "github.com/matryer/is" + "go.uber.org/mock/gomock" +) + +func TestClient_NewFromContext(t *testing.T) { + is := is.New(t) + service := mock.NewService(gomock.NewController(t)) + ctx := WithSchemaService(context.Background(), service) + + s, err := New(ctx) + is.NoErr(err) + is.Equal(s, service) +} + +func TestClient_NewGRPC(t *testing.T) { + is := is.New(t) + ctx := context.Background() + + s, err := New(ctx) + is.NoErr(err) + _, ok := s.(*v1.Client) + is.True(ok) +} diff --git a/go.mod b/go.mod index 7124810..ca1dd7d 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/conduitio/conduit-commons v0.2.1-0.20240612170747-b6e7093d3b24 github.com/golangci/golangci-lint v1.59.0 github.com/hashicorp/go-plugin v1.6.1 + github.com/matryer/is v1.4.1 go.uber.org/mock v0.4.0 google.golang.org/grpc v1.64.0 google.golang.org/protobuf v1.34.1