Files
havenllo/internal/store/sqlite_test.go
Hermes 041c3fab4b
Some checks failed
Build and deploy Havenllo / Verify Go and frontend (push) Failing after 7s
Build and deploy Havenllo / Build and push image (push) Has been skipped
Build and deploy Havenllo / Apply and restart Havenllo (push) Has been skipped
feat: implement Havenllo single-board kanban (Go+SQLite backend, Preact/Vite frontend)
- Single fixed 'Haven' board: lists (To do/In progress/Done) + cards, no multi-board
- Go 1.24 backend, CGO-free modernc.org/sqlite, embedded SPA, REST /api
- Preact + Vite + TS frontend, native HTML5 drag-and-drop, optimistic UI, dark Haven theme
- PVC (nfs-client) for SQLite, root container on NFS, simple nginx ingress havenllo.haven
- Dockerfile multi-arch build, Gitea CI via pipeline-actions@main
2026-07-14 10:13:51 -03:00

30 lines
741 B
Go

package store_test
import (
"context"
"path/filepath"
"testing"
"havenllo/internal/database"
"havenllo/internal/store"
)
func TestSnapshotUsesPositionOrder(t *testing.T) {
t.Parallel()
db, err := database.Open(context.Background(), filepath.Join(t.TempDir(), "havenllo.db"))
if err != nil {
t.Fatal(err)
}
defer db.Close()
if _, err := db.Exec("INSERT INTO lists (name, position) VALUES ('First', 1), ('Last', 9999)"); err != nil {
t.Fatal(err)
}
snapshot, err := store.Snapshot(context.Background(), db)
if err != nil {
t.Fatal(err)
}
if len(snapshot.Lists) != 5 || snapshot.Lists[0].Name != "First" || snapshot.Lists[len(snapshot.Lists)-1].Name != "Last" {
t.Fatalf("unexpected order: %#v", snapshot.Lists)
}
}