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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started