Files
MrAlders0n 9bbf8efee5 release: v2.0.4 (#217)
* perf(routes): batch cross-IATA and hash route search (#216)

One search fired a /routes/cross request per IATA pair (138k on 2026-10-08). Route search now takes an optional iatas list and runs a fixed number of index-backed queries. /info advertises built-in minimum client versions.

* chore: bump version to 2.0.4
2026-10-09 22:17:23 -04:00

36 lines
954 B
Go

// Copyright 2026 Beacon Contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
package api
import (
"regexp"
"testing"
)
func TestHigherVersion(t *testing.T) {
for _, tc := range []struct{ a, b, want string }{
{"", "", ""},
{"2.0.3", "", "2.0.3"},
{"", "2.0.3", "2.0.3"},
{"2.0.3", "2.0.10", "2.0.10"},
{"2.1.0", "2.0.9", "2.1.0"},
{"10.0.0", "9.9.9", "10.0.0"},
{"2.0.3", "2.0.3", "2.0.3"},
} {
if got := HigherVersion(tc.a, tc.b); got != tc.want {
t.Errorf("HigherVersion(%q, %q) = %q, want %q", tc.a, tc.b, got, tc.want)
}
}
}
// Clients reject anything but plain X.Y.Z, so a typo here would lock them all out.
func TestClientFloorsAreValid(t *testing.T) {
re := regexp.MustCompile(`^[0-9]+\.[0-9]+\.[0-9]+$`)
for name, v := range map[string]string{"MinAppVersion": MinAppVersion, "MinWebVersion": MinWebVersion} {
if v != "" && !re.MatchString(v) {
t.Errorf("%s = %q, want X.Y.Z or empty", name, v)
}
}
}