cli/pkg/cmd/pr/shared
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
..
commentable.go Add --generate-notes flag to gh release create command. (#4467) 2021-12-08 15:20:59 +04:00
comments.go Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
display.go Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
display_test.go Isolate pr list command 2020-08-04 18:38:06 +02:00
editable.go Avoid race condition when updating labels 2021-12-08 13:29:47 +01:00
editable_http.go Simplify GraphQL mutations whose response we are not interested in 2021-12-08 13:35:19 +01:00
finder.go Avoid showing non-open PRs on the default branch (#4285) 2021-12-20 18:46:12 +00:00
finder_test.go Avoid showing non-open PRs on the default branch (#4285) 2021-12-20 18:46:12 +00:00
params.go Merge pull request #4279 from SiarheiFedartsou/sf-pr-list-head-filter 2021-10-14 20:54:56 +02:00
params_test.go Merge pull request #4279 from SiarheiFedartsou/sf-pr-list-head-filter 2021-10-14 20:54:56 +02:00
preserve.go Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
preserve_test.go Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
reaction_groups.go Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
state.go Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
survey.go #4386 Display a user's name in metadata survey for assignees and reviewers (#4420) 2022-01-12 08:52:22 +00:00
survey_test.go Improve Survey prompt stubber for tests 2022-01-12 23:51:21 +01:00
templates.go Repace shurcool/graphql with cli/shurcool-graphql 2021-11-17 12:57:43 -08:00
templates_test.go Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00