cli/pkg
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
..
cmd Improve Survey prompt stubber for tests 2022-01-12 23:51:21 +01:00
cmdutil Refactor factory.Executable() to be a method rather than a func 2021-12-21 13:50:55 +01:00
export Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
extensions binary extension create 2021-11-23 16:53:45 -06:00
findsh go fmt 2021-12-02 16:12:24 +01:00
githubsearch Convert bool to string early for pr list draft flag 2021-09-20 11:29:37 -07:00
githubtemplate Use T.TempDir for temporary dirs in tests (#3580) 2021-05-07 12:21:26 +02:00
httpmock Adding gh release download for .zip and .tar.gz 2021-11-30 15:52:51 +01:00
iostreams go fmt 2021-12-02 16:12:24 +01:00
jsoncolor Fix "null" display in colored JSON output 2021-05-12 16:56:52 +02:00
liveshare Oops, left it as second from debugging 2021-10-28 16:33:13 -07:00
markdown Enable emoji in markdown 2021-04-12 09:50:51 -07:00
prompt Improve Survey prompt stubber for tests 2022-01-12 23:51:21 +01:00
set repo edit: add ability to add or remove repository topics 2021-12-07 19:28:29 +01:00
surveyext Add --generate-notes flag to gh release create command. (#4467) 2021-12-08 15:20:59 +04:00
text Add helper template functions for rendering tables (#3519) 2021-08-23 21:00:25 +02:00