feat(tests): add comprehensive test suite, update deps and Go 1.26.1

- Add 20+ tests for utility functions, SharedData, and Model
- Tests cover: LoadTables, LoadTableData, UpdateCell, pagination,
  table inference, focus/blur, empty database, invalid indices
- Update Go to 1.26.1, upgrade all dependencies
- Replace custom Min/Max with Go builtin min/max
- Format all files with goimports
- Add staticcheck to CI workflow
This commit is contained in:
2026-03-13 02:46:03 +00:00
parent 7913b17d74
commit aa4c97c553
15 changed files with 581 additions and 169 deletions

View File

@@ -8,25 +8,25 @@ import "github.com/charmbracelet/bubbles/key"
// - G: go to end (single 'G' press)
type QueryKeyMap struct {
// Input mode keys
Execute key.Binding
Escape key.Binding
CursorLeft key.Binding
CursorRight key.Binding
WordLeft key.Binding
WordRight key.Binding
LineStart key.Binding
LineEnd key.Binding
DeleteWord key.Binding
Execute key.Binding
Escape key.Binding
CursorLeft key.Binding
CursorRight key.Binding
WordLeft key.Binding
WordRight key.Binding
LineStart key.Binding
LineEnd key.Binding
DeleteWord key.Binding
// Results mode keys
Up key.Binding
Down key.Binding
Enter key.Binding
EditQuery key.Binding
GoToStart key.Binding
GoToEnd key.Binding
Back key.Binding
ToggleHelp key.Binding
Up key.Binding
Down key.Binding
Enter key.Binding
EditQuery key.Binding
GoToStart key.Binding
GoToEnd key.Binding
Back key.Binding
ToggleHelp key.Binding
}
// DefaultQueryKeyMap returns the default keybindings for query view
@@ -69,7 +69,7 @@ func DefaultQueryKeyMap() QueryKeyMap {
key.WithKeys("ctrl+w"),
key.WithHelp("ctrl+w", "delete word"),
),
// Results mode
Up: key.NewBinding(
key.WithKeys("up", "k"),
@@ -119,4 +119,4 @@ func (k QueryKeyMap) FullHelp() [][]key.Binding {
{k.CursorLeft, k.CursorRight, k.WordLeft, k.WordRight},
{k.LineStart, k.LineEnd, k.DeleteWord, k.ToggleHelp},
}
}
}