sqs-browse: started working on tests for controllers

This commit is contained in:
Leon Mika 2022-03-24 08:49:09 +11:00
parent fb749aaee2
commit 43680000a8
14 changed files with 305 additions and 39 deletions

View file

@ -0,0 +1,21 @@
package testuictx
import (
"context"
tea "github.com/charmbracelet/bubbletea"
"github.com/lmika/awstools/internal/common/ui/dispatcher"
"github.com/lmika/awstools/internal/common/ui/uimodels"
)
func New(ctx context.Context) (context.Context, *TestUIContext) {
td := &TestUIContext{}
return uimodels.WithContext(ctx, dispatcher.DispatcherContext{td}), td
}
type TestUIContext struct {
Messages []tea.Msg
}
func (t *TestUIContext) Send(msg tea.Msg) {
t.Messages = append(t.Messages, msg)
}