I would really appreciate, if you can go through Postman’s learning center and check about writing test script.
Now since our data is in variable map and mapValue, there is no point in passing data.form.body
The code will look something like this
var data = pm.request.body
var myReq = data.formdata
var map = myReq.reduce((r, i) => ((r[i.key] = r[i.key] || []).push(i), r), {});
var mapValue = myReq.reduce((r, i) => ((r[i.value] = r[i.value] || []).push(i), r), {});
pm.test("Request body to have form Data key", function () {
pm.expect(mapValue.client_credentials[0].value).to.be.a("string").and.is.not.null.and.to.not.be.undefined.and.is.not.empty
});
pm.test("Request body to have form Data value", function () {
pm.expect(mapValue.default[0].value).to.be.a("string").and.is.not.null
});
As I said, it will be great help if you can research a bit more (solutions are all around)
Cheers