test: type the off-spec WHOOP profile and drop a version-stamped comment

The realism ratchet counts as-never casts and the version-stamp ratchet
refuses comment lines that open with a release; both caught the previous
commits.
This commit is contained in:
Marc-André Bombeck committed 2026-10-31 10:00:39 +01:00
1 parent 369c063701
commit 087c8868cf
2 files changed
+7 -4

No files matched your search

@@ -1,4 +1,5 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import type { WhoopProfile } from "@/lib/whoop/wire-types";
// Single-use claiming is covered against Postgres in
// tests/integration/oauth-callback-single-use.test.ts. Here the state row is
@@ -182,7 +183,9 @@ describe("GET /api/whoop/callback custom-scheme redirect", () => {
returnScheme: null,
});
const { fetchProfile } = await import("@/lib/whoop/client");
vi.mocked(fetchProfile).mockResolvedValueOnce({} as never);
// An off-spec body: the wire type says user_id is always there.
const offSpec: Partial<WhoopProfile> = {};
vi.mocked(fetchProfile).mockResolvedValueOnce(offSpec as WhoopProfile);
const res = await GET(makeReq("nonce-noid"));
+3 -3
View File
@@ -56,9 +56,9 @@ export async function healGoogleHealthAccountId(
}
/**
* The sync cycle's hook: after a clean cycle, a connection from before
* v1.46.4 (no account id since migration 0491) reads its id back. A
* connection that has one is left alone, so the profile is read once.
* The sync cycle's hook: after a clean cycle, a connection that migration
* 0491 left without an account id reads it back. A connection that has one
* is left alone, so the profile is read once.
*/
export async function healUnknownGoogleHealthAccountId(
userId: string,