Update corps-bind test mock to expect POST for approval style preferences

This commit is contained in:
gitea committed 2026-09-11 11:50:36 +08:00
1 parent 112473a2b7
commit 55dcd20d48
1 file changed
+6 -6
+6 -6
View File
@@ -302,9 +302,9 @@ describe("corps sync-test", () => {
expect(parsed.productionGuarantees.prodRulesStayDraft).toBe(true);
expect(parsed.productionGuarantees.prodVersionPublished).toBe(false);
const patchPref = requests.find((r) => r.method === "PATCH" && r.path.includes("config"));
expect(patchPref).toBeDefined();
expect((patchPref?.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
const postPref = requests.find((r) => (r.method === "POST" || r.method === "PATCH") && r.path.includes("config"));
expect(postPref).toBeDefined();
expect((postPref?.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
const deleteRule = requests.find((r) => r.method === "DELETE" && r.path === "/api/v1/rules/test-rule-old");
expect(deleteRule).toBeDefined();
@@ -402,10 +402,10 @@ function mockSealSyncRequests(options: {
});
}
if (url.pathname === "/api/v1/agent/ai-approval/config" && method === "PATCH") {
if (url.pathname === "/api/v1/agent/ai-approval/config" && (method === "POST" || method === "PATCH")) {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.("PATCH", url.pathname, body);
return jsonResponse({ data: body });
options.onMutation?.(method, url.pathname, body);
return jsonResponse({ data: { success: true } });
}
if (url.pathname === "/api/v1/rules" && method === "GET") {