generated from deploymenttheory/Template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test framework for client init
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package client | ||
|
||
import ( | ||
"testing" | ||
|
||
msgraphbetasdk "github.com/microsoftgraph/msgraph-beta-sdk-go" | ||
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// MockGraphServiceClient is a mock implementation of the GraphServiceClient for testing purposes. | ||
type MockGraphServiceClient struct{} | ||
|
||
// Ensure MockGraphServiceClient implements the necessary methods for both stable and beta clients. | ||
|
||
func TestGraphClients(t *testing.T) { | ||
stableClient := &MockGraphServiceClient{} | ||
betaClient := &MockGraphServiceClient{} | ||
|
||
clients := GraphClients{ | ||
StableClient: stableClient, | ||
BetaClient: betaClient, | ||
} | ||
|
||
assert.NotNil(t, clients.StableClient, "StableClient should not be nil") | ||
assert.NotNil(t, clients.BetaClient, "BetaClient should not be nil") | ||
|
||
assert.Equal(t, stableClient, clients.StableClient, "StableClient should be set correctly") | ||
assert.Equal(t, betaClient, clients.BetaClient, "BetaClient should be set correctly") | ||
} | ||
|
||
func TestGraphClientsInitialization(t *testing.T) { | ||
stableClient := &msgraphsdk.GraphServiceClient{} | ||
betaClient := &msgraphbetasdk.GraphServiceClient{} | ||
|
||
clients := GraphClients{ | ||
StableClient: stableClient, | ||
BetaClient: betaClient, | ||
} | ||
|
||
if clients.StableClient != stableClient { | ||
t.Errorf("Expected StableClient to be %v, got %v", stableClient, clients.StableClient) | ||
} | ||
|
||
if clients.BetaClient != betaClient { | ||
t.Errorf("Expected BetaClient to be %v, got %v", betaClient, clients.BetaClient) | ||
} | ||
} |