- 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
30 lines
741 B
Go
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)
|
|
}
|
|
}
|