feat: support updating Garmin credentials at runtime
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,3 +20,20 @@ func TestParseAuthResult(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMcpClient_UpdateCredentials_ResetsStartedState(t *testing.T) {
|
||||
c := &mcpClient{cfg: Config{GarminEmail: "old@example.com", GarminPassword: "old"}}
|
||||
c.started = true // simulate an already-spawned subprocess
|
||||
|
||||
c.UpdateCredentials("new@example.com", "new")
|
||||
|
||||
if c.cfg.GarminEmail != "new@example.com" || c.cfg.GarminPassword != "new" {
|
||||
t.Errorf("cfg after update = %+v, want new@example.com/new", c.cfg)
|
||||
}
|
||||
if c.started {
|
||||
t.Error("started should be reset to false so the next call respawns the subprocess")
|
||||
}
|
||||
if c.inner != nil {
|
||||
t.Error("inner should be cleared so ensureStarted spawns a fresh client")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user