refactor: extract server-side CRM contact update
This commit is contained in:
@@ -835,9 +835,7 @@ test("updateaccount returns CONTACT_ID_REQUIRED when contactId missing", async (
|
||||
const mod = loadModule("pages/api/endpoint/updateaccount_api.js", {
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
axios: async () => ({ data: { contactid: "c1" } }),
|
||||
updateCrmContact: async () => ({ contactid: "c1" }),
|
||||
consoleLogger: () => {}
|
||||
});
|
||||
|
||||
@@ -853,9 +851,7 @@ test("updateaccount returns ACCOUNT_UPDATE_PAYLOAD_REQUIRED when body missing",
|
||||
const mod = loadModule("pages/api/endpoint/updateaccount_api.js", {
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
axios: async () => ({ data: { contactid: "c1" } }),
|
||||
updateCrmContact: async () => ({ contactid: "c1" }),
|
||||
consoleLogger: () => {}
|
||||
});
|
||||
|
||||
@@ -874,9 +870,7 @@ test("updateaccount catch path returns ACCOUNT_UPDATE_FAILED", async () => {
|
||||
const mod = loadModule("pages/api/endpoint/updateaccount_api.js", {
|
||||
respondError: respondErrorMock,
|
||||
respondSuccess: respondSuccessMock,
|
||||
getToken: async () => ({ access_token: "token" }),
|
||||
hashAPIPath: () => "&hash=expected",
|
||||
axios: async () => {
|
||||
updateCrmContact: async () => {
|
||||
throw new Error("relay failed");
|
||||
},
|
||||
consoleLogger: () => {}
|
||||
|
||||
Reference in New Issue
Block a user