As @danny-dainton pointed out the mistake with your tests, you’ll need to fix that.
Also, the error that you’re receiving is because you’re calling pm.response.HolidayRightsResults[0]
Now, pm.response is a string and you haven’t parsed it as JSON yet, and you’re trying to access a property called HolidayRightsResults of this string, which has given you undefined, then further you try to access the 0th index of this undefined value which hence gave you the error `Cannot read property ‘0’ of undefined’.
What you actually wanted is the following:
// Updated script here
var response = pm.response.json(),
array_Id = 0,
afwz_typ = response.HolidayRightsResults[0].HolidayRights[array_Id].AFWZ_TYP;
pm.test("Rechten Afwz_type "+ afwz_typ + " are ok!", function() {
// Use the parsed JSON in your assertion and not `pm.response` directly
pm.expect(response.HolidayRightsResults[0].HolidayRights[array_Id].AFWZ_TYP).to.equal(07);
// ...
});