style: apply prettier across the tree

One-shot prettier pass so the new format:check gate starts from a clean
baseline. Formatting only — no behaviour change. Generator-owned and
vendored artifacts stay untouched via .prettierignore.
This commit is contained in:
Marc-André Bombeck committed 2026-06-19 22:20:31 +02:00
1 parent b3fea2ef59
commit 1f4ba5939d
1000 files changed
+12130 -8385

No files matched your search

@@ -62,7 +62,10 @@ process.env.NEXT_PUBLIC_APP_URL = "https://app.example";
function makeReq(nonce: string): NextRequest {
return {
url: `https://app.example/api/whoop/callback?code=auth-code&state=${nonce}`,
cookies: { get: (name: string) => (name === "whoop_state" ? { value: nonce } : undefined) },
cookies: {
get: (name: string) =>
name === "whoop_state" ? { value: nonce } : undefined,
},
} as unknown as NextRequest;
}
@@ -20,7 +20,8 @@ vi.mock("@/lib/rate-limit", () => ({
vi.mock("@/lib/whoop/client", () => ({
getAuthorizationUrl: vi.fn(
(nonce: string) => `https://api.prod.whoop.com/oauth/oauth2/auth?state=${nonce}`,
(nonce: string) =>
`https://api.prod.whoop.com/oauth/oauth2/auth?state=${nonce}`,
),
}));
@@ -55,7 +56,9 @@ import { checkRateLimit } from "@/lib/rate-limit";
import type { NextRequest } from "next/server";
const create = prisma.whoopOAuthState.create as ReturnType<typeof vi.fn>;
const consume = consumeWhoopConnectTicket as unknown as ReturnType<typeof vi.fn>;
const consume = consumeWhoopConnectTicket as unknown as ReturnType<
typeof vi.fn
>;
const reqAuth = requireAuth as unknown as ReturnType<typeof vi.fn>;
function makeReq(url: string): NextRequest {
@@ -72,9 +75,7 @@ describe("GET /api/whoop/connect", () => {
});
it("cookie path: 302s to WHOOP and stores the state row (no scheme)", async () => {
const res = await GET(
makeReq("https://app.example/api/whoop/connect"),
);
const res = await GET(makeReq("https://app.example/api/whoop/connect"));
expect(res.status).toBe(307);
expect(res.headers.get("location")).toContain(
"api.prod.whoop.com/oauth/oauth2/auth",
@@ -127,9 +128,7 @@ describe("GET /api/whoop/connect", () => {
expect(create.mock.calls[0][0].data.returnScheme).toBeNull();
create.mockClear();
await GET(
makeReq(
"https://app.example/api/whoop/connect?return_scheme=javascript",
),
makeReq("https://app.example/api/whoop/connect?return_scheme=javascript"),
);
expect(create.mock.calls[0][0].data.returnScheme).toBeNull();
});
+4 -1
View File
@@ -30,7 +30,10 @@ export const POST = apiHandler(async () => {
);
if (!rl.allowed) {
annotate({ action: { name: "whoop.connect.ticket.rate_limited" } });
return apiError("Too many connect-ticket requests. Try again shortly.", 429);
return apiError(
"Too many connect-ticket requests. Try again shortly.",
429,
);
}
// BYO-key gate: a ticket is only useful if the user has WHOOP credentials
@@ -81,11 +81,12 @@ describe("/api/whoop/credentials", () => {
it("DELETE clears credentials and connection", async () => {
userUpdate.mockResolvedValue({});
(prisma.whoopConnection.delete as ReturnType<typeof vi.fn>).mockResolvedValue(
{},
);
const res = (await (DELETE as unknown as () => Promise<{ data: unknown }>)())
.data as { deleted: boolean };
(
prisma.whoopConnection.delete as ReturnType<typeof vi.fn>
).mockResolvedValue({});
const res = (
await (DELETE as unknown as () => Promise<{ data: unknown }>)()
).data as { deleted: boolean };
expect(res.deleted).toBe(true);
expect(userUpdate).toHaveBeenCalledWith({
where: { id: "u1" },
@@ -98,9 +99,9 @@ describe("/api/whoop/credentials", () => {
it("DELETE audits the teardown and parks the ledger (04-L1 parity)", async () => {
userUpdate.mockResolvedValue({});
(prisma.whoopConnection.delete as ReturnType<typeof vi.fn>).mockResolvedValue(
{},
);
(
prisma.whoopConnection.delete as ReturnType<typeof vi.fn>
).mockResolvedValue({});
await (DELETE as unknown as () => Promise<unknown>)();
expect(auditLog).toHaveBeenCalledWith("whoop.credentials.delete", {
userId: "u1",
@@ -56,15 +56,18 @@ function signedRequest(
const signature = createHmac("sha256", signingSecret)
.update(timestamp + rawBody, "utf8")
.digest("base64");
return new NextRequest("https://app.example.com/api/whoop/webhook/" + SECRET, {
method: "POST",
headers: {
"content-type": "application/json",
"X-WHOOP-Signature": signature,
"X-WHOOP-Signature-Timestamp": timestamp,
return new NextRequest(
"https://app.example.com/api/whoop/webhook/" + SECRET,
{
method: "POST",
headers: {
"content-type": "application/json",
"X-WHOOP-Signature": signature,
"X-WHOOP-Signature-Timestamp": timestamp,
},
body: rawBody,
},
body: rawBody,
});
);
}
const ctx = (token: string) => ({ params: Promise.resolve({ token }) });