Skip to content

Commit

Permalink
[WIP] Test_PromptInput_IfUrlIsEmptyThenReturnError
Browse files Browse the repository at this point in the history
  • Loading branch information
sshehrozali committed Sep 26, 2024
1 parent 889ea35 commit 7a3fa8c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions internal/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/stretchr/testify/assert"
)

var url string

func Test_PromptInput_IfUrlIsNotEmptyThenReturnUrl(t *testing.T) {
os.Args = []string{"cmd", "-url", "dummy_download_url"}

Expand All @@ -15,10 +17,11 @@ func Test_PromptInput_IfUrlIsNotEmptyThenReturnUrl(t *testing.T) {
assert.Equal(t, "dummy_download_url", url)
}

func Test_PromptInput_IfUrlIsEmptyThenReturnError(t *testing.T) {
os.Args = []string{"cmd", "-url", ""}
// func Test_PromptInput_IfUrlIsEmptyThenReturnError(t *testing.T) {
// flag.StringVar(&url, "url", "", "URL to download")
// os.Args = []string{"cmd", "-url", ""}

_, err := PromptInput()
// _, err := PromptInput()

assert.Error(t, err, "Error occured")
}
// assert.Error(t, err, "Error occured")
// }

0 comments on commit 7a3fa8c

Please sign in to comment.