0

I'm trying make a test to my API server and I don't get test result no pass.

My code:

var data = JSON.parse(responseBody);
var days = data["days"];

var total_distance = 0;
days.forEach(function(value,index,array){
    total_distance = total_distance + value["distance"];
});
pm.test("Distance data"),function(){
    pm.expect(data["total_distance"].to.equal(total_distance));
}

This script never returns no pass. What is my error?

Miliow
  • 15
  • 3

1 Answers1

0

The syntax for your test is incorrect. You have a closing parentheses after pm.test("Distance data" which should actually be the last character on the last line.

Try:

pm.test("Distance data", function () {
    pm.expect(data["total_distance"].to.equal(total_distance));
});
Matt
  • 720
  • 8
  • 15