Skip to content

Commit

Permalink
add billing client to viam client test
Browse files Browse the repository at this point in the history
  • Loading branch information
purplenicole730 committed Nov 21, 2024
1 parent d94b8a3 commit b8482dc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/viam_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func TestCreateViamClientWithAPIKeyTests(t *testing.T) {
}
}

func TestNewDataClient(t *testing.T) {
func TestNewAppClients(t *testing.T) {
originalDialDirectGRPC := dialDirectGRPC
dialDirectGRPC = mockDialDirectGRPC
defer func() { dialDirectGRPC = originalDialDirectGRPC }()
Expand All @@ -135,6 +135,16 @@ func TestNewDataClient(t *testing.T) {
test.That(t, err, test.ShouldBeNil)
defer client.Close()

billingClient := client.Billingclient()
test.That(t, billingClient, test.ShouldNotBeNil)
test.That(t, billingClient, test.ShouldHaveSameTypeAs, &BillingClient{})
test.That(t, billingClient.client, test.ShouldImplement, (*pb.DataServiceClient)(nil))

// Testing that a second call to Billingclient() returns the same instance
billingClient2 := client.Billingclient()
test.That(t, billingClient2, test.ShouldNotBeNil)
test.That(t, billingClient, test.ShouldResemble, billingClient2)

dataClient := client.DataClient()
test.That(t, dataClient, test.ShouldNotBeNil)
test.That(t, dataClient, test.ShouldHaveSameTypeAs, &DataClient{})
Expand Down

0 comments on commit b8482dc

Please sign in to comment.