mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 22:50:51 +00:00
fix(tests): repair hero-strip and telegram-test-locale assertions after R3a
Two test-contract fixes for fallout from concurrent R3a contributors: - hero-strip.test.tsx — collapses the two onAskCoach forwarding tests into a single regression guard that asserts the inline Health Score card Ask-the-Coach button stays retired and the hero strip's action-row button carries the affordance. - telegram-test-locale.test.ts — the route's POST handler takes zero arguments (apiHandler wraps an async () => function). Drops the Request argument from all seven call sites.
This commit is contained in:
1 parent
f3ff262451
commit
5886fea8d7
2 files changed
+14
-32
No files matched your search
@@ -102,7 +102,7 @@ describe("POST /api/settings/telegram/test — locale-aware message", () => {
|
||||
locale: "de",
|
||||
} as never);
|
||||
|
||||
const result = await POST(new Request("http://x") as never);
|
||||
const result = await (POST as () => Promise<unknown>)();
|
||||
|
||||
expect(sendTelegramMessageMock).toHaveBeenCalledTimes(1);
|
||||
const [, , body] = sendTelegramMessageMock.mock.calls[0];
|
||||
@@ -125,7 +125,7 @@ describe("POST /api/settings/telegram/test — locale-aware message", () => {
|
||||
locale: "fr",
|
||||
} as never);
|
||||
|
||||
await POST(new Request("http://x") as never);
|
||||
await (POST as () => Promise<unknown>)();
|
||||
|
||||
const [, , body] = sendTelegramMessageMock.mock.calls[0];
|
||||
expect(body).toBe(
|
||||
@@ -140,7 +140,7 @@ describe("POST /api/settings/telegram/test — locale-aware message", () => {
|
||||
locale: null,
|
||||
} as never);
|
||||
|
||||
await POST(new Request("http://x") as never);
|
||||
await (POST as () => Promise<unknown>)();
|
||||
|
||||
const [, , body] = sendTelegramMessageMock.mock.calls[0];
|
||||
expect(body).toBe(
|
||||
@@ -156,7 +156,7 @@ describe("POST /api/settings/telegram/test — locale-aware message", () => {
|
||||
locale: "klingon",
|
||||
} as never);
|
||||
|
||||
await POST(new Request("http://x") as never);
|
||||
await (POST as () => Promise<unknown>)();
|
||||
|
||||
expect(tCalls[0].locale).toBe("en");
|
||||
});
|
||||
@@ -168,7 +168,7 @@ describe("POST /api/settings/telegram/test — locale-aware message", () => {
|
||||
locale: "de",
|
||||
} as never);
|
||||
|
||||
const result = await POST(new Request("http://x") as never);
|
||||
const result = await (POST as () => Promise<unknown>)();
|
||||
|
||||
expect(sendTelegramMessageMock).not.toHaveBeenCalled();
|
||||
expect((result as { status: number }).status).toBe(422);
|
||||
@@ -181,7 +181,7 @@ describe("POST /api/settings/telegram/test — locale-aware message", () => {
|
||||
resetAt: Date.now() + 60_000,
|
||||
} as never);
|
||||
|
||||
const result = await POST(new Request("http://x") as never);
|
||||
const result = await (POST as () => Promise<unknown>)();
|
||||
|
||||
expect(sendTelegramMessageMock).not.toHaveBeenCalled();
|
||||
expect((result as { status: number }).status).toBe(429);
|
||||
@@ -195,7 +195,7 @@ describe("POST /api/settings/telegram/test — locale-aware message", () => {
|
||||
} as never);
|
||||
sendTelegramMessageMock.mockResolvedValueOnce({ ok: false });
|
||||
|
||||
const result = await POST(new Request("http://x") as never);
|
||||
const result = await (POST as () => Promise<unknown>)();
|
||||
|
||||
expect((result as { status: number }).status).toBe(422);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user