dynamo-browse/internal/common/ui/commandctrl/commandctrl_test.go

31 lines
738 B
Go
Raw Normal View History

package commandctrl_test
import (
"context"
"github.com/lmika/audax/internal/common/ui/events"
"github.com/lmika/audax/internal/dynamo-browse/services"
"testing"
2022-07-28 11:36:16 +00:00
"github.com/lmika/audax/internal/common/ui/commandctrl"
"github.com/stretchr/testify/assert"
)
func TestCommandController_Prompt(t *testing.T) {
t.Run("prompt user for a command", func(t *testing.T) {
cmd := commandctrl.NewCommandController(mockIterProvider{})
res := cmd.Prompt()
2022-03-28 20:48:09 +00:00
promptForInputMsg, ok := res.(events.PromptForInputMsg)
assert.True(t, ok)
2022-03-28 20:48:09 +00:00
assert.Equal(t, ":", promptForInputMsg.Prompt)
})
}
type mockIterProvider struct {
}
func (m mockIterProvider) Iter(ctx context.Context, category string) services.HistoryProvider {
return nil
}