feat(hk): explain background updates with protected content links and retry details
This commit is contained in:
1 parent
dd7613850e
commit
c5c9941768
42 files changed
+1542
-145
No files matched your search
@@ -51,6 +51,8 @@ vi.mock("@/lib/db", async () => {
|
||||
requestHash: String(hash),
|
||||
resultJson: null,
|
||||
});
|
||||
} else if (sql.startsWith("SELECT CAST(LAST_INSERT_ID() AS CHAR)")) {
|
||||
return [[{ id: "9007199254740993" }]];
|
||||
} else if (sql.startsWith("SELECT id,request_hash")) {
|
||||
return [[state.operations.get(params.join(":"))]];
|
||||
} else if (sql.startsWith("UPDATE cms_operations")) {
|
||||
@@ -121,6 +123,18 @@ describe("news saves", () => {
|
||||
expect(state.notify).toHaveBeenCalledOnce();
|
||||
expect(state.effects).toHaveLength(1);
|
||||
});
|
||||
it("stores safe article context for background deliveries without the body", async () => {
|
||||
expect((await createArticle(form())).ok).toBe(true);
|
||||
const result = JSON.parse(
|
||||
[...state.operations.values()][0].resultJson ?? "null",
|
||||
);
|
||||
expect(result).toEqual({
|
||||
ok: true,
|
||||
articleId: "9007199254740993",
|
||||
articleTitle: "Test news",
|
||||
});
|
||||
expect(result).not.toHaveProperty("fullStory");
|
||||
});
|
||||
it("returns success when cache refresh fails after the article commits", async () => {
|
||||
state.invalidate.mockRejectedValue(Error("cache unavailable"));
|
||||
await expect(createArticle(form())).resolves.toMatchObject({ ok: true });
|
||||
|
||||
Reference in new issue
Block a user