dynamo-browse/internal/common/ui/commandctrl/commandctrl_test.go
Leon Mika 54a120342e
Added command history (#45)
* Added command line history to the command, query and filter prompts.
* Added query planning debugging to the log.
* Fixed bug in query expression which was not treating true and false as boolean literals.
* Fixed a bug in the query planning logic which was incorrectly determine that an expression of the form sort_key ^= "string", with no partition key, could be executed as a query instead of a scan.
2023-01-26 21:46:31 +11:00

31 lines
738 B
Go

package commandctrl_test
import (
"context"
"github.com/lmika/audax/internal/common/ui/events"
"github.com/lmika/audax/internal/dynamo-browse/services"
"testing"
"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()
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
}