Does Postman change the validation properties for its free version

64 Views Asked by At

I am using Postman free version for my API testing project, I have a scenario where I have to validate the length of my JSON property but when I write the test code, Postman does not read the .length function neither gives me recommendation for length functions and for hasOwnProperty function.

Am I missing any installation beforehand or those specific validation are only available in paid version not in free version?

Additional Info :- I also tried postman extension inside VS code still could not get any success. Below is my JSON response and sample test code:

JSON Response :-

{
        idDigit: 1234567891111
        subidDigit: 987654321
        checkDigit: 0
        status: false
}  

  
    

Test Function :-

var jsonData = pm.response.json();
var prop = jsonData.idDigit;
pm.test("Check length of JSON property", function () {
const expectedLength = 13; // 
pm.expect(prop.length).to.equal(expectedLength);
});

Error :- AssertionError: expected undefined to equal 13

1

There are 1 best solutions below

3
Jeremy Fiel On

You are not checking the actual property

EDIT:

pm.expect(prop).to.have.lengthOf(expectedLength)

To answer your question about limiting functionality, the answer is no.