diff options
Diffstat (limited to 'ride/store_test.go')
| -rw-r--r-- | ride/store_test.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ride/store_test.go b/ride/store_test.go index 1ee3c69..1fca056 100644 --- a/ride/store_test.go +++ b/ride/store_test.go @@ -20,11 +20,20 @@ func newTestDB(t *testing.T) *sql.DB { func sampleRide(t *testing.T) StoredRide { t.Helper() - gpxPath := filepath.Join(t.TempDir(), "ride.gpx") + dir := t.TempDir() + gpxPath := filepath.Join(dir, "ride.gpx") require.NoError(t, os.WriteFile(gpxPath, []byte(testGPX), 0o600)) + fitPath := filepath.Join(dir, "ride.fit") + parsed, err := ParseFile(GPXRideParser{}, gpxPath) + require.NoError(t, err) + f, err := os.Create(fitPath) + require.NoError(t, err) + require.NoError(t, EncodeFIT(parsed, f)) + require.NoError(t, f.Close()) return StoredRide{ ExternalID: "strava:1234", GPXPath: gpxPath, + FitPath: fitPath, Name: "Morning Ride", Type: "Ride", StartDate: time.Date(2026, 8, 1, 7, 30, 0, 0, time.UTC), @@ -112,6 +121,7 @@ func TestSaveAllowsRideWithoutGPX(t *testing.T) { indoor := sampleRide(t) indoor.ExternalID = "strava:14701658670" indoor.GPXPath = "" + indoor.FitPath = "" require.NoError(t, Save(db, indoor)) |
