Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hariso committed Jun 13, 2024
1 parent acf859a commit 6c1f722
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
45 changes: 45 additions & 0 deletions conduit/schema/client/client_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c1f722

Please sign in to comment.