* feat: add plugin system * fix db docker build * fix hammerhead readme, add strava subscription news to docs * fixes and sdk improvements * fix: reduce Meilisearch load, debounce federation sync (#1012) * optimize meili trail index * several fixes --------- Co-authored-by: Flomp <Flomp@users.noreply.github.com> * Bump svelte from 5.55.5 to 5.56.0 in /docs (#1032) Bumps [svelte](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte) from 5.55.5 to 5.56.0. - [Release notes](https://github.com/sveltejs/svelte/releases) - [Changelog](https://github.com/sveltejs/svelte/blob/main/packages/svelte/CHANGELOG.md) - [Commits](https://github.com/sveltejs/svelte/commits/svelte@5.56.0/packages/svelte) --- updated-dependencies: - dependency-name: svelte dependency-version: 5.56.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Flomp <Flomp@users.noreply.github.com> * Release v0.19.2 (#1035) * chore: release v0.19.2 * add changelog --------- Co-authored-by: Flomp <26000991+Flomp@users.noreply.github.com> Co-authored-by: Christian Beutel <> * speed up plugin sync and several small fixes * concepts for security improvements and process stability * improve concept * security concept implemented * remove insecure TLS * worker concept implemented * fixes and cleanup * fixes * docu * mermaid, namings * WASM plugin host improvements, plugin logging * fix db migration * Improve plugin config and category mapping UI * fixes * further fixes * remove manual test sync * fix db migration and strava mapping * type added, UI improvements * fix plugin card toggle clickable area * optimize synch status card layout * plugin type 'trails' instead of 'integration' * session auth validation in UI * fix komoot date and waypoints * improve category mapping * fix send to hammerhead: trail name * plugin setup error handling improved * fix review findings * re-mapping added * rename remote_category --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Flomp <Flomp@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Flomp <26000991+Flomp@users.noreply.github.com>
135 lines
3.5 KiB
Go
135 lines
3.5 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestWaypointsFromEmbeddedWayPoints(t *testing.T) {
|
|
tour := &detailedTour{
|
|
Embedded: detailedTourEmbedded{
|
|
WayPoints: timeline{
|
|
Embedded: timelineEmbedded{
|
|
Items: []timelineItem{{
|
|
Embedded: timelineItemEmbedded{
|
|
Reference: waypointReference{
|
|
ID: flexibleID("2355158"),
|
|
Name: "Ruedertaler Hofglace Rastplatz",
|
|
Location: point{
|
|
Lat: 47.280262,
|
|
Lng: 8.046906,
|
|
Alt: 476.7,
|
|
},
|
|
StartPoint: point{
|
|
Lat: 47.280262,
|
|
Lng: 8.046906,
|
|
Alt: 476.7,
|
|
},
|
|
},
|
|
},
|
|
}},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
points := waypoints(tour)
|
|
if len(points) != 1 {
|
|
t.Fatalf("expected 1 waypoint, got %d", len(points))
|
|
}
|
|
if points[0].ExternalID != "2355158" || points[0].Name != "Ruedertaler Hofglace Rastplatz" {
|
|
t.Fatalf("unexpected waypoint identity: %#v", points[0])
|
|
}
|
|
if points[0].Lat != 47.280262 || points[0].Lon != 8.046906 || points[0].Ele == nil || *points[0].Ele != 476.7 {
|
|
t.Fatalf("unexpected waypoint coordinates: %#v", points[0])
|
|
}
|
|
}
|
|
|
|
func TestWaypointsDeduplicateWayPointsAndTimeline(t *testing.T) {
|
|
item := timelineItem{
|
|
Embedded: timelineItemEmbedded{
|
|
Reference: waypointReference{
|
|
ID: flexibleID("8277503"),
|
|
Name: "Aarebruecke bei Aarburg",
|
|
StartPoint: point{Lat: 47.320204, Lng: 7.897589},
|
|
},
|
|
},
|
|
}
|
|
tour := &detailedTour{
|
|
Embedded: detailedTourEmbedded{
|
|
WayPoints: timeline{Embedded: timelineEmbedded{Items: []timelineItem{item}}},
|
|
Timeline: timeline{Embedded: timelineEmbedded{Items: []timelineItem{item}}},
|
|
},
|
|
}
|
|
|
|
points := waypoints(tour)
|
|
if len(points) != 1 {
|
|
t.Fatalf("expected duplicate waypoint to be collapsed, got %d", len(points))
|
|
}
|
|
}
|
|
|
|
func TestWaypointsIncludeFrontImage(t *testing.T) {
|
|
tour := &detailedTour{
|
|
Embedded: detailedTourEmbedded{
|
|
WayPoints: timeline{
|
|
Embedded: timelineEmbedded{
|
|
Items: []timelineItem{{
|
|
Embedded: timelineItemEmbedded{
|
|
Reference: waypointReference{
|
|
ID: flexibleID("4266004"),
|
|
Name: "Blick auf die Solothurner Altstadt und die St.-Ursen-Kathedrale",
|
|
StartPoint: point{Lat: 47.205925, Lng: 7.535326, Alt: 424.6},
|
|
Embedded: waypointSubEmbedded{
|
|
FrontImage: imageItem{
|
|
ID: flexibleID("48446190"),
|
|
Src: "https://example.test/image.jpg",
|
|
Type: "image/*",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
points := waypoints(tour)
|
|
if len(points) != 1 {
|
|
t.Fatalf("expected 1 waypoint, got %d", len(points))
|
|
}
|
|
if len(points[0].Photos) != 1 {
|
|
t.Fatalf("expected 1 waypoint photo, got %d", len(points[0].Photos))
|
|
}
|
|
if points[0].Photos[0].ExternalID != "48446190" || points[0].Photos[0].Source.URL != "https://example.test/image.jpg" {
|
|
t.Fatalf("unexpected waypoint photo: %#v", points[0].Photos[0])
|
|
}
|
|
}
|
|
|
|
func TestWaypointPhotosDeduplicateFrontImage(t *testing.T) {
|
|
item := timelineItem{
|
|
Embedded: timelineItemEmbedded{
|
|
Reference: waypointReference{
|
|
Embedded: waypointSubEmbedded{
|
|
FrontImage: imageItem{
|
|
ID: flexibleID("48446190"),
|
|
Src: "https://example.test/front.jpg",
|
|
Type: "image/*",
|
|
},
|
|
Images: coverImages{
|
|
Embedded: imagesEmbedded{
|
|
Items: []imageItem{{
|
|
ID: flexibleID("48446190"),
|
|
Src: "https://example.test/front.jpg",
|
|
Type: "image/*",
|
|
}},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
photos := waypointPhotos(item)
|
|
if len(photos) != 1 {
|
|
t.Fatalf("expected duplicate front image to be collapsed, got %d", len(photos))
|
|
}
|
|
}
|