feat(settings): put a sync-now button on the four cards that lacked one

A route with no caller is an API detail, not a feature. The Oura, Polar,
Strava and Nightscout cards get the same action WHOOP already had, in the
same row as Test connection, rendered only once connected: post the sync,
show the count or the failure, invalidate the reads that depend on
measurements. No full-history dialog, since these providers have no such
arm. Keys added across the six locales.
This commit is contained in:
Marc-André Bombeck committed 2026-07-25 04:43:12 +02:00
1 parent a9f1629f82
commit 0bcbb88db1
10 files changed
+252

No files matched your search

@@ -83,3 +83,26 @@ describe("NightscoutCard — parked + test + data-link + invalidation", () => {
expect(invalidatedKeys).toContainEqual(queryKeys.nightscoutStatus());
});
});
/**
* v1.32.28 — sync now, matching the treatment the OAuth cards get.
*/
describe("NightscoutCard — sync-now action", () => {
it("offers the sync action on a connected instance", () => {
statusPayload = {
connected: true,
configured: true,
state: "connected",
lastSuccessAt: null,
lastError: null,
};
const html = render();
expect(html).toContain('data-testid="nightscout-sync"');
expect(html).toContain("Sync now");
});
it("does not offer it before an instance is configured", () => {
statusPayload = { connected: false, configured: false };
expect(render()).not.toContain('data-testid="nightscout-sync"');
});
});
@@ -178,3 +178,34 @@ describe("OAuthProviderCard — redirect-URI mini-guide (v1.29.x, UX audit H2)",
expect(html).not.toContain('data-testid="polar-redirect-guide"');
});
});
/**
* v1.32.28 — sync now. The route without the button would be an endpoint with
* no caller; the button is what makes the manual sync a feature rather than an
* API detail. Rendered only once the provider is connected, in the same action
* row as Test connection.
*/
describe("OAuthProviderCard — sync-now action", () => {
it("offers the sync action on a connected provider", () => {
statusPayload = {
connected: true,
configured: true,
available: true,
state: "connected",
lastSuccessAt: null,
lastError: null,
};
const html = render();
expect(html).toContain('data-testid="polar-sync"');
expect(html).toContain("Sync now");
});
it("does not offer it before the provider is connected", () => {
statusPayload = {
connected: false,
configured: true,
available: true,
};
expect(render()).not.toContain('data-testid="polar-sync"');
});
});