Initial commit: smartrun MVP
Garmin run classification and progression tracker. Go backend (MCP client to mcp-garmin, SQLite store, deterministic rule engine, REST API) and React/TS frontend (Dashboard, Review Queue, Workout Kinds). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
31
backend/internal/store/syncstate_test.go
Normal file
31
backend/internal/store/syncstate_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSyncState_DefaultsAndUpdate(t *testing.T) {
|
||||
db := openTestDB(t)
|
||||
ctx := context.Background()
|
||||
|
||||
state, err := db.GetSyncState(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("GetSyncState: %v", err)
|
||||
}
|
||||
if state.EarliestSyncedDate != nil || state.BackfillComplete {
|
||||
t.Fatalf("expected fresh DB to have no watermark, got %+v", state)
|
||||
}
|
||||
|
||||
if err := db.UpdateSyncState(ctx, "2023-01-01", true); err != nil {
|
||||
t.Fatalf("UpdateSyncState: %v", err)
|
||||
}
|
||||
|
||||
state, err = db.GetSyncState(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("GetSyncState after update: %v", err)
|
||||
}
|
||||
if state.EarliestSyncedDate == nil || *state.EarliestSyncedDate != "2023-01-01" || !state.BackfillComplete {
|
||||
t.Fatalf("state after update = %+v, want earliest=2023-01-01 complete=true", state)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user