refactor(api): migrate batch 12 remaining relay-get candidates

This commit is contained in:
2026-03-24 10:27:27 +00:00
parent bf1ba9bc1e
commit da29e789c0
9 changed files with 194 additions and 172 deletions
@@ -1069,14 +1069,13 @@ test("getadvancedsearch catch path returns ADVANCED_SEARCH_FETCH_FAILED", async
const mod = loadModule("pages/api/endpoint/getadvancedsearch_api.js", {
respondError: respondErrorMock,
respondSuccess: respondSuccessMock,
getToken: async () => ({ access_token: "token" }),
hashAPIPath: () => "&hash=expected",
relayGet: async ({ res, errorResponse }) =>
respondErrorMock(res, errorResponse),
relayGetData: async () => ({
data: { value: [] },
accessToken: "token"
}),
azureHeadersPaged: () => ({}),
axios: {
get: async () => {
throw new Error("relay failed");
}
},
consoleLogger: () => {}
});
@@ -2005,12 +2004,9 @@ test("getbasicsearch_by_lparref catch path returns BASIC_SEARCH_LPA_REF_FETCH_FA
{
respondError: respondErrorMock,
respondSuccess: respondSuccessMock,
getToken: async () => {
throw new Error("token failed");
relayGetData: async () => {
throw new Error("relay failed");
},
hashAPIPath: () => "&hash=expected",
azureHeaders: () => ({}),
axios: { get: async () => ({ data: { value: [] } }) },
consoleLogger: () => {}
}
);
@@ -2033,11 +2029,7 @@ test("getbasicsearch_by_address success returns existing payload contract", asyn
respondError: respondErrorMock,
respondSuccess: respondSuccessMock,
getToken: async () => ({ access_token: "token" }),
hashAPIPath: () => "&hash=expected",
azureHeaders: () => ({}),
axios: {
get: async () => ({ data: { value: [] } })
},
relayGetData: async () => ({ data: { value: [] } }),
consoleLogger: () => {},
jsonpath: () => []
}
@@ -2063,10 +2055,8 @@ test("getbasicsearch_by_address catch path returns BASIC_SEARCH_BY_ADDRESS_FETCH
getToken: async () => {
throw new Error("token failed");
},
hashAPIPath: () => "&hash=expected",
azureHeaders: () => ({}),
axios: {
get: async () => ({ data: { value: [] } })
relayGetData: async () => {
throw new Error("relay failed");
},
consoleLogger: () => {},
jsonpath: () => []
@@ -2744,14 +2734,10 @@ test("deletewatchedcasesproxy catch path returns WATCHED_CASE_PROXY_DELETE_FAILE
{
respondError: respondErrorMock,
respondSuccess: respondSuccessMock,
getToken: async () => ({ access_token: "token" }),
hashAPIPath: () => "&hash=expected",
azureHeaders: () => ({}),
axios: {
get: async () => {
throw new Error("proxy delete failed");
}
forwardGetData: async () => {
throw new Error("proxy delete failed");
},
azureHeaders: () => ({}),
consoleLogger: () => {},
process: { env: {} }
}
@@ -3412,13 +3398,8 @@ test("getdnscoords catch path returns DNS_COORDS_FETCH_FAILED", async () => {
const mod = loadModule("pages/api/endpoint/getdnscoords_api.js", {
respondError: respondErrorMock,
respondSuccess: respondSuccessMock,
getToken: async () => ({ access_token: "token" }),
hashAPIPath: () => "&hash=expected",
azureHeaders: () => ({}),
axios: {
get: async () => {
throw new Error("relay failed");
}
relayGetData: async () => {
throw new Error("relay failed");
},
consoleLogger: () => {},
OSPoint: function () {}