Skip to content

Commit 2d35824

Browse files
authored
test: Add mock ghclient to TestCheckFile with dependency injection (#185)
Adds mock GitHub client initialization to TestCheckFile following the same pattern used in TestIsCodeRepo. This ensures consistency across the test suite by using dependency injection for the GitHub client. Part of #184
1 parent 186985e commit 2d35824

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

data/rest-data_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ func TestCheckFile(t *testing.T) {
6565

6666
for _, tt := range tests {
6767
t.Run(tt.name, func(t *testing.T) {
68+
mockClient := mock.NewMockedHTTPClient()
69+
ghClient := github.NewClient(mockClient)
6870
rest := &RestData{
71+
ghClient: ghClient,
72+
owner: "test-owner",
73+
repo: "test-repo",
6974
contents: RepoContent{
7075
Content: tt.toplevel,
7176
SubContent: map[string]RepoContent{

0 commit comments

Comments
 (0)