cli/pkg/cmd
Mislav Marohnić 3c443efbed Improve Survey prompt stubber for tests
Both SurveyAsk and SurveyAskOne methods now share the same sets of
stubs, making it possible to change which of these methods is used in
the implementation without breaking tests.

A new method `AskStubber.StubPrompt("<prompt>")` is added as test helper
to supersede old Stub and StubOne methods. The new helper matches on
prompt messages rather than on field names, enabling tests to be written
based on what the user would see rather than coupling to implementation
details.

The new stubber also allows verifying whether a Select or MultiSelect
was rendered with the expected set of options. Furthermore, if a stubbed
value is not present among those options, the stubber will panic instead
of continuing normally.

Stubbed Selects with an int instead of a string target receiver are now
transparently handled. The values for Select stubs are always strings in
tests, but the stubber will write an int answer if the receiver expects
one as a selected index instead of a selected string value.

Lastly, this set of changes improves test resiliency since the stubs are
now matched based on prompt message (or field name for legacy stubs
created with Stub) instead of sequentially, enabling the implementation
to reorder the prompts without breaking existing tests.
2022-01-12 23:51:21 +01:00
..
actions Mark actions command as non-runnable 2021-11-03 16:58:51 +01:00
alias Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
api api: handle HTTP 409 error message from the server 2021-12-06 19:54:54 +01:00
auth Merge pull request #3997 from nicknotfun/non-interactive-auth 2022-01-12 15:59:30 +01:00
browse Fix browse last commit when using the repo override flag (#4845) 2021-12-13 15:00:22 +01:00
codespace Revert "move gh cs ssh --config into a separate gh cs ssh config command" 2022-01-06 10:03:54 -07:00
completion Add FlagErrorf; encapsulate FlagError.error 2021-10-21 11:40:20 -04:00
config linter complains again 2021-11-16 10:43:25 -08:00
extension extension upgrade: do not consider up-to-date to be a failure (#4857) 2021-12-16 12:59:22 +01:00
factory Refactor factory.Executable() to be a method rather than a func 2021-12-21 13:50:55 +01:00
gist Add --generate-notes flag to gh release create command. (#4467) 2021-12-08 15:20:59 +04:00
gpg-key Add FlagErrorf; encapsulate FlagError.error 2021-10-21 11:40:20 -04:00
issue Simplify GraphQL mutations whose response we are not interested in 2021-12-08 13:35:19 +01:00
pr Improve Survey prompt stubber for tests 2022-01-12 23:51:21 +01:00
release Add interactive tag selector to create release (#4525) 2021-12-08 16:20:15 +04:00
repo repo sync: Use the new merge-upstream API if available 2021-12-21 16:44:27 +01:00
root Store Executable() information on codespaces App 2021-12-21 14:03:10 +01:00
run Add --json export flag for workflow runs (#3869) 2021-12-17 15:55:45 +00:00
secret Improve setting multiple secrets 2021-12-20 23:35:31 +01:00
ssh-key Don't swallow duplicate key error (#4807) 2021-11-25 13:22:42 +01:00
version Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
workflow pr checks: count "cancelled" jobs as failing instead of neutral (#4850) 2021-12-16 12:01:53 +01:00