feat: add plugin system (#1034)
* 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>
This commit is contained in:
53
plugins/komoot/komoot_test.go
Normal file
53
plugins/komoot/komoot_test.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/open-wanderer/wanderer/plugins/sdk"
|
||||
)
|
||||
|
||||
func TestAcceptLanguageFromLocale(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
locale string
|
||||
want string
|
||||
}{
|
||||
{name: "empty", locale: "", want: ""},
|
||||
{name: "language only", locale: "de", want: "de"},
|
||||
{name: "underscore region", locale: "de_CH", want: "de-CH,de;q=0.9"},
|
||||
{name: "hyphen region", locale: "en-US", want: "en-US,en;q=0.9"},
|
||||
{name: "trim space", locale: " fr_FR ", want: "fr-FR,fr;q=0.9"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if got := acceptLanguage(test.locale); got != test.want {
|
||||
t.Fatalf("acceptLanguage(%q) = %q, want %q", test.locale, got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequestHeadersOnlySendAuthToAPIConnector(t *testing.T) {
|
||||
client := &komootClient{
|
||||
userID: "user",
|
||||
token: "token",
|
||||
locale: "de_CH",
|
||||
}
|
||||
|
||||
apiHeaders := client.requestHeaders("api")
|
||||
if apiHeaders[sdk.AuthHeaderAuthorization] == "" {
|
||||
t.Fatalf("expected api connector authorization header")
|
||||
}
|
||||
if apiHeaders["Accept-Language"] != "de-CH,de;q=0.9" {
|
||||
t.Fatalf("unexpected api accept language: %#v", apiHeaders)
|
||||
}
|
||||
|
||||
webHeaders := client.requestHeaders("web")
|
||||
if webHeaders[sdk.AuthHeaderAuthorization] != "" {
|
||||
t.Fatalf("expected no web connector authorization header, got %#v", webHeaders)
|
||||
}
|
||||
if webHeaders["Accept-Language"] != "de-CH,de;q=0.9" {
|
||||
t.Fatalf("unexpected web accept language: %#v", webHeaders)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user