From 2aaf940805f94588f5c180c25bec53c11fda9396 Mon Sep 17 00:00:00 2001 From: pashakostohrys Date: Tue, 5 Nov 2024 23:18:22 +0200 Subject: [PATCH] chore: better test coverage for prompt util Signed-off-by: pashakostohrys --- cmd/argocd/commands/utils/prompt_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/argocd/commands/utils/prompt_test.go b/cmd/argocd/commands/utils/prompt_test.go index 9b533131398ef..4acf96f743f0c 100644 --- a/cmd/argocd/commands/utils/prompt_test.go +++ b/cmd/argocd/commands/utils/prompt_test.go @@ -51,15 +51,15 @@ func TestConfirmBaseOnCountZeroApps(t *testing.T) { func TestConfirmPrompt(t *testing.T) { cases := []struct { - input string - output bool + input string + output bool }{ {"y\n", true}, {"n\n", false}, } - + origStdin := os.Stdin - + for _, c := range cases { tmpFile, err := writeToStdin(c.input) if err != nil { @@ -71,15 +71,15 @@ func TestConfirmPrompt(t *testing.T) { os.Remove(tmpFile.Name()) _ = tmpFile.Close() } - + os.Stdin = origStdin } func TestConfirmAllPrompt(t *testing.T) { cases := []struct { - input string - confirm bool - confirmAll bool + input string + confirm bool + confirmAll bool }{ {"y\n", true, false}, {"n\n", false, false}, @@ -119,8 +119,8 @@ func writeToStdin(msg string) (*os.File, error) { if _, err := tmpFile.Seek(0, 0); err != nil { return nil, err } - + os.Stdin = tmpFile return tmpFile, nil -} \ No newline at end of file +}