table-select: fixed tests

This commit is contained in:
Leon Mika 2022-03-29 07:48:09 +11:00
parent 9709e6aed1
commit b5375f0197
3 changed files with 20 additions and 19 deletions

View file

@ -1,12 +1,10 @@
package commandctrl_test
import (
"context"
"testing"
"github.com/lmika/awstools/internal/common/ui/commandctrl"
"github.com/lmika/awstools/internal/common/ui/events"
"github.com/lmika/awstools/test/testuictx"
"github.com/stretchr/testify/assert"
)
@ -14,13 +12,10 @@ func TestCommandController_Prompt(t *testing.T) {
t.Run("prompt user for a command", func(t *testing.T) {
cmd := commandctrl.NewCommandController(nil)
ctx, uiCtx := testuictx.New(context.Background())
err := cmd.Prompt().Execute(ctx)
res := cmd.Prompt()()
assert.NoError(t, err)
promptMsg, ok := uiCtx.Messages[0].(events.PromptForInput)
promptForInputMsg, ok := res.(events.PromptForInputMsg)
assert.True(t, ok)
assert.Equal(t, ":", promptMsg.Prompt)
assert.Equal(t, ":", promptForInputMsg.Prompt)
})
}