Guest User

Untitled

a guest
Nov 15th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. {
  2. "data": [
  3. {
  4. "id": "123",
  5. "type": "something",
  6. "created": "1540952074",
  7. "test": [
  8. {
  9. "key1": "asd123",
  10. "key2": "166802"
  11. }
  12. ]
  13. },
  14.  
  15. pm.test('returns the correct parameters by type', () => {
  16. for (i = 0; i < jsonData.data.length; i++) {
  17. if (jsonData.data[i].type === 'something') {
  18. // for (j = 0; j < jsonData.data.test.length; j++) {
  19.  
  20. pm.expect(jsonData.data[i]).to.have.property('id');
  21. pm.expect(jsonData.data[i]).to.have.property('type');
  22. pm.expect(jsonData.data[i]).to.have.property('created');
  23.  
  24. pm.expect(jsonData.data[i].test[0]).to.have.property('key1');
  25. pm.expect(jsonData.data[i].test[0]).to.have.property("key2");
  26. }
  27.  
  28. returns the correct parameters by type | TypeError: Cannot read property '0' of undefined
  29.  
  30. Object:{}
  31. key1:"asd123"
  32. key2:"166802"
Add Comment
Please, Sign In to add comment