Question: Im having an issue with the TODO in this code snippet. //parse the response into an object var jsonData = JSON.parse(responseBody); var id = jsonData.items[0].id;

Im having an issue with the TODO in this code snippet.

//parse the response into an object var jsonData = JSON.parse(responseBody); var id = jsonData.items[0].id;

//set environment variable for second request (for volume) postman.setEnvironmentVariable("id", id); console.log("title " + title); //regular expression (basically looking for the word turing in the title) var patt = /turing/i; //this example is testing just the first book, your mission is to loop through all books //TODO: Loop through all books and validate they all have turing in the title

var allBookshavetitle = jsonData.every(function(item) { return patt.test(items.volumeInfo.title); });

//var title = jsonData.items[0].volumeInfo.title; //var res = patt.test(title); //console.log(res); tests["books have turing in title"] = (res === true); tests["Status code is 200"] = responseCode.code === 200;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!