Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Fix CLI unit tests #1607

Merged
merged 8 commits into from
Feb 23, 2024
7 changes: 3 additions & 4 deletions internal/pkg/service/cli/dialog/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@ func TestDialogs_AskInitOptions_No_CI(t *testing.T) {
o.Set("ci", "false")
o.Set("branches", "main")

f := syncInit.Flags{
Branches: configmap.NewValue("main"),
CI: configmap.NewValue(false),
}
f := syncInit.DefaultFlags()
f.Branches = configmap.NewValueWithOrigin("main", configmap.SetByFlag)
f.CI = configmap.NewValueWithOrigin(false, configmap.SetByFlag)
Comment on lines -112 to +114
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this test could ever work 🤔 , you have to simulate that the value has been set by the flag.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Yes, I found this out in several tests


// Run
opts, err := syncInit.AskInitOptions(context.Background(), dialog, d, f)
Expand Down