mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor: remove helpers the new output and prompts left unused
Drop writeDownload, terminal.Require, terminal.Confirm, terminal.Row, terminal.Record and Pulls.FindOpenByHead, which no command calls anymore, and point their tests at the code that replaced them. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
8 files changed
+34
-118
No files matched your search
@@ -56,12 +56,12 @@ func TestPromptPolicy(t *testing.T) {
|
||||
}
|
||||
prompt := &fakePrompt{}
|
||||
value := "supplied"
|
||||
asked, err := Require(context.Background(), &value, "title", Streams{}, Policy{}, prompt)
|
||||
asked, err := RequireInput(context.Background(), &value, "title", "title", nil, Streams{}, Policy{}, prompt)
|
||||
require.NoError(t, err)
|
||||
require.False(t, asked)
|
||||
require.Zero(t, prompt.inputs)
|
||||
value = ""
|
||||
_, err = Require(context.Background(), &value, "title", Streams{}, Policy{}, prompt)
|
||||
_, err = RequireInput(context.Background(), &value, "title", "title", nil, Streams{}, Policy{}, prompt)
|
||||
require.ErrorContains(t, err, "--title")
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ func TestConfirmActionPassesTheDefault(t *testing.T) {
|
||||
prompt := &askingPrompt{accept: true}
|
||||
streams := Streams{InTTY: true, ErrTTY: true}
|
||||
require.NoError(t, ConfirmAction(context.Background(), Confirmation{Prompt: "Create pull request?", DefaultYes: true}, false, streams, Policy{Enabled: true}, prompt))
|
||||
require.NoError(t, Confirm(context.Background(), "Delete branch?", false, streams, Policy{Enabled: true}, prompt))
|
||||
require.NoError(t, ConfirmAction(context.Background(), Confirmation{Prompt: "Delete branch?"}, false, streams, Policy{Enabled: true}, prompt))
|
||||
require.Equal(t, []bool{true, false}, prompt.defaults)
|
||||
require.Equal(t, []string{"Create pull request?", "Delete branch?"}, prompt.titles)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user