-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add additional help text with missing access-token (#219)
Add additional help text with missing access-token
- Loading branch information
Showing
11 changed files
with
67 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package validators_test | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"ldcli/cmd/validators" | ||
) | ||
|
||
func TestCmdError(t *testing.T) { | ||
t.Run("with missing access-token value shows additional help", func(t *testing.T) { | ||
var expected string | ||
expected += "required flag(s) \"access-token\" not set.\n\n" | ||
expected += "Use `ldcli config --set access-token <value>` to configure the value to persist across CLI commands.\n\n" | ||
expected += "See `ldcli command action --help` for supported flags and usage." | ||
|
||
err := validators.CmdError( | ||
errors.New(`required flag(s) "access-token" not set`), | ||
"ldcli command action", | ||
) | ||
|
||
assert.EqualError(t, err, expected) | ||
}) | ||
|
||
t.Run("with missing other flag value shows regular help", func(t *testing.T) { | ||
expected := "required flag(s) \"my-flag\" not set. See `ldcli command action --help` for supported flags and usage." | ||
|
||
err := validators.CmdError( | ||
errors.New(`required flag(s) "my-flag" not set`), | ||
"ldcli command action", | ||
) | ||
|
||
assert.EqualError(t, err, expected) | ||
}) | ||
} |