Garmin run classification and progression tracker. Go backend (MCP client to mcp-garmin, SQLite store, deterministic rule engine, REST API) and React/TS frontend (Dashboard, Review Queue, Workout Kinds). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
23 lines
652 B
Go
23 lines
652 B
Go
package garmin
|
|
|
|
import "testing"
|
|
|
|
func TestParseAuthResult(t *testing.T) {
|
|
cases := []struct {
|
|
msg string
|
|
want AuthStatus
|
|
}{
|
|
{"Authenticated successfully.", AuthSuccess},
|
|
{"MFA accepted. Authenticated successfully.", AuthSuccess},
|
|
{"MFA required. Garmin has sent a verification code...", AuthMFARequired},
|
|
{"Authentication failed: 401 Unauthorized (Invalid Username or Password)", AuthFailed},
|
|
{"Authentication failed after MFA: bad code", AuthFailed},
|
|
}
|
|
for _, c := range cases {
|
|
got := parseAuthResult(c.msg)
|
|
if got.Status != c.want {
|
|
t.Errorf("parseAuthResult(%q).Status = %v, want %v", c.msg, got.Status, c.want)
|
|
}
|
|
}
|
|
}
|