You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(librarian): Inject client factories and add test for generate default (#1918)
This PR refactors `newCommandRunner` in `command.go` to accept
`GitHubClientFactory` and `ContainerClientFactory` as arguments,
improving testability by enabling direct injection of mock clients.
Key changes include:
* Defined `GitHubClientFactory` and `ContainerClientFactory` types in
`command.go`.
* Updated `newCommandRunner` to use these factories, with default
implementations if `nil` is passed.
* Modified callers of `newCommandRunner` (e.g., in `generate.go`,
`release_init.go`, `tag_and_release.go`) to pass `nil, nil` for the new
factory arguments to retain default behavior.
* Added `TestGenerate_DefaultBehavior` to `librarian_test.go` to test
the default `librarian generate` execution. This test utilizes the new
factory arguments in `newGenerateRunner` to inject mock clients.
Fixes#1906
0 commit comments