summaryrefslogtreecommitdiff
path: root/internal/hexaiaction
diff options
context:
space:
mode:
Diffstat (limited to 'internal/hexaiaction')
-rw-r--r--internal/hexaiaction/tui_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/hexaiaction/tui_test.go b/internal/hexaiaction/tui_test.go
index 0f7d091..6f1debc 100644
--- a/internal/hexaiaction/tui_test.go
+++ b/internal/hexaiaction/tui_test.go
@@ -34,3 +34,24 @@ func TestHandleKey_JumpEndWithG(t *testing.T) {
}
}
+func TestItemMethods(t *testing.T) {
+ it := item{title: "T", desc: "D", kind: ActionRewrite, hotkey: 'r'}
+ if it.Title() != "T" || it.Description() != "D" || it.FilterValue() != "T" {
+ t.Fatalf("item methods wrong: %+v", it)
+ }
+}
+
+func TestModelInitAndViewAndUpdate(t *testing.T) {
+ m := newModel()
+ if m.Init() != nil {
+ t.Fatalf("Init should return nil cmd")
+ }
+ if v := m.View(); v == "" {
+ t.Fatalf("View should not be empty before done")
+ }
+ // Window resize
+ nm, _ := m.Update(tea.WindowSizeMsg{Width: 80, Height: 24})
+ if _, ok := nm.(model); !ok {
+ t.Fatalf("expected model after WindowSizeMsg")
+ }
+}