31 lines
741 B
Go
31 lines
741 B
Go
|
package commandctrl_test
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"lmika.dev/cmd/ssm-browse/internal/common/ui/events"
|
||
|
"lmika.dev/cmd/ssm-browse/internal/ssm-browse/services"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"lmika.dev/cmd/ssm-browse/internal/common/ui/commandctrl"
|
||
|
)
|
||
|
|
||
|
func TestCommandController_Prompt(t *testing.T) {
|
||
|
t.Run("prompt user for a command", func(t *testing.T) {
|
||
|
cmd := commandctrl.NewCommandController(mockIterProvider{})
|
||
|
|
||
|
res := cmd.Prompt()
|
||
|
|
||
|
promptForInputMsg, ok := res.(events.PromptForInputMsg)
|
||
|
assert.True(t, ok)
|
||
|
assert.Equal(t, ":", promptForInputMsg.Prompt)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
type mockIterProvider struct {
|
||
|
}
|
||
|
|
||
|
func (m mockIterProvider) Iter(ctx context.Context, category string) services.HistoryProvider {
|
||
|
return nil
|
||
|
}
|