TASK22211: normalize new-appeal appeal types endpoint contract
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { respondSuccess } from "../middleware/apiResponse";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /api/endpoint/getappealtypesfornewappeal_api:
|
* /api/endpoint/getappealtypesfornewappeal_api:
|
||||||
@@ -11,8 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const ApiResponse = (req, res) => {
|
const ApiResponse = (req, res) => {
|
||||||
res.statusCode = 200;
|
return respondSuccess(res, {
|
||||||
res.json({
|
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"value": "Planning Appeal - S78",
|
"value": "Planning Appeal - S78",
|
||||||
@@ -20,9 +21,9 @@ const ApiResponse = (req, res) => {
|
|||||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||||
"846,040,000",
|
"846,040,000",
|
||||||
"attributevalue": 846040000,
|
"attributevalue": 846040000
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3591,6 +3591,26 @@ test("getmandatoryfields returns WHICH_FORM_REQUIRED when whichForm missing", as
|
|||||||
assert.strictEqual(res.state.jsonBody.error.code, "WHICH_FORM_REQUIRED");
|
assert.strictEqual(res.state.jsonBody.error.code, "WHICH_FORM_REQUIRED");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("getappealtypesfornewappeal returns success payload contract", async () => {
|
||||||
|
const mod = loadModule(
|
||||||
|
"pages/api/endpoint/getappealtypesfornewappeal_api.js",
|
||||||
|
{
|
||||||
|
respondSuccess: respondSuccessMock
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const req = { query: {} };
|
||||||
|
const res = createRes();
|
||||||
|
await mod.default(req, res);
|
||||||
|
|
||||||
|
assert.strictEqual(res.state.statusCode, 200);
|
||||||
|
assert.strictEqual(Array.isArray(res.state.jsonBody.value), true);
|
||||||
|
assert.strictEqual(
|
||||||
|
res.state.jsonBody.value[0].value,
|
||||||
|
"Planning Appeal - S78"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("getsipsmedia returns success contract", async () => {
|
test("getsipsmedia returns success contract", async () => {
|
||||||
const mod = loadModule("pages/api/endpoint/getsipsmedia_api.js", {
|
const mod = loadModule("pages/api/endpoint/getsipsmedia_api.js", {
|
||||||
respondSuccess: respondSuccessMock
|
respondSuccess: respondSuccessMock
|
||||||
|
|||||||
Reference in New Issue
Block a user