harden(eoc-push): fånga mappningsfel så pushen aldrig kastar
This commit is contained in:
@@ -135,4 +135,25 @@ describe("pushOpsSummaryToEoc", () => {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
it("does not throw when payload mapping fails", async () => {
|
||||
process.env.EOC_URL = "https://eoc.example.com";
|
||||
process.env.EOC_PUSH_TOKEN = "tok";
|
||||
await redis.set(
|
||||
"ops:summary:cache",
|
||||
JSON.stringify({
|
||||
as_of: new Date().toISOString(),
|
||||
app: { app: "cibello" },
|
||||
wall: { boards: [{ title: 123, tiles: "nej" }] },
|
||||
}),
|
||||
"EX",
|
||||
60,
|
||||
);
|
||||
|
||||
await expect(pushOpsSummaryToEoc(redis)).resolves.toEqual({
|
||||
ok: false,
|
||||
status: null,
|
||||
error: expect.stringMatching(/payload mapping failed/),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user