TASK22211: normalize new-appeal appeal types endpoint contract
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { respondSuccess } from "../middleware/apiResponse";
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/endpoint/getappealtypesfornewappeal_api:
|
||||
@@ -11,8 +13,7 @@
|
||||
*/
|
||||
|
||||
const ApiResponse = (req, res) => {
|
||||
res.statusCode = 200;
|
||||
res.json({
|
||||
return respondSuccess(res, {
|
||||
"value": [
|
||||
{
|
||||
"value": "Planning Appeal - S78",
|
||||
@@ -20,9 +21,9 @@ const ApiResponse = (req, res) => {
|
||||
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
|
||||
"attributevalue@OData.Community.Display.V1.FormattedValue":
|
||||
"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");
|
||||
});
|
||||
|
||||
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 () => {
|
||||
const mod = loadModule("pages/api/endpoint/getsipsmedia_api.js", {
|
||||
respondSuccess: respondSuccessMock
|
||||
|
||||
Reference in New Issue
Block a user