diff --git a/cmd/root.go b/cmd/root.go index 3b0a3da..8331fd5 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -159,11 +159,11 @@ func (m rootAppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cmds = append(cmds, m.input.Focus()) return m, tea.Batch(cmds...) } - case "j", "up": + case "j", "down": if m.mode == NORMAL && m.currentIndex+1 <= m.rowsCount { m.currentIndex += 1 } - case "k", "down": + case "k", "up": if m.mode == NORMAL && m.currentIndex-1 != 0 { m.currentIndex -= 1 } diff --git a/store/database_test.go b/store/database_test.go new file mode 100644 index 0000000..6c327e7 --- /dev/null +++ b/store/database_test.go @@ -0,0 +1,37 @@ +package store_test + +import ( + "github.com/lukasmwerner/mark/store" + "testing" +) + +func TestSearchBookmarks(t *testing.T) { + tests := []struct { + name string // description of this test case + // Named input parameters for target function. + db *store.DB + query string + want []store.Bookmark + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, gotErr := store.SearchBookmarks(tt.db, tt.query) + if gotErr != nil { + if !tt.wantErr { + t.Errorf("SearchBookmarks() failed: %v", gotErr) + } + return + } + if tt.wantErr { + t.Fatal("SearchBookmarks() succeeded unexpectedly") + } + // TODO: update the condition below to compare got with tt.want. + if true { + t.Errorf("SearchBookmarks() = %v, want %v", got, tt.want) + } + }) + } +}