- Add migration 0004_workout_taxonomy.sql to reset workout_kinds table with exactly 7 fixed named kinds (Easy Run, Long Run, Threshold 30', Threshold 60', Tempo, Interval, MAS Test), each with a never-matching placeholder rule - Add test TestWorkoutTaxonomy_SeededWithSevenFixedTypes to verify all 7 kinds are seeded and active - Update TestKindAssignment_AppendOnlyHistoryAndCurrentView to use a unique kind name to avoid conflict with seeded kinds Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
838 B
Go
37 lines
838 B
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestWorkoutTaxonomy_SeededWithSevenFixedTypes(t *testing.T) {
|
|
db := openTestDB(t)
|
|
ctx := context.Background()
|
|
|
|
kinds, err := db.ListWorkoutKinds(ctx, true)
|
|
if err != nil {
|
|
t.Fatalf("ListWorkoutKinds: %v", err)
|
|
}
|
|
if len(kinds) != 7 {
|
|
t.Fatalf("expected 7 seeded workout kinds, got %d: %+v", len(kinds), kinds)
|
|
}
|
|
|
|
wantNames := map[string]bool{
|
|
"Easy Run": false, "Long Run": false, "Threshold 30'": false, "Threshold 60'": false,
|
|
"Tempo": false, "Interval": false, "MAS Test": false,
|
|
}
|
|
for _, k := range kinds {
|
|
if _, ok := wantNames[k.Name]; !ok {
|
|
t.Errorf("unexpected seeded kind name %q", k.Name)
|
|
continue
|
|
}
|
|
wantNames[k.Name] = true
|
|
}
|
|
for name, found := range wantNames {
|
|
if !found {
|
|
t.Errorf("expected seeded kind %q, not found", name)
|
|
}
|
|
}
|
|
}
|