I have this return value from my API
["A", "B", "C"]
And I'm trying to get postman to check that the values are found.
pm.test("Successful GET request", function () {
var jsonData = pm.response.json()
var expectedJsonBody = ['A','B','C']
var ev = JSON.stringify(expectedJsonBody)
pm.expect(jsonData).to.be.oneOf(ev)
});
I get an error saying
AssertionError: expected '["A","B","C"]' to be an array
I have tried
pm.expect(jsonData).to.eql('["A", "B", "C"]')
And it works but it has to be exact. If returns returned is ["B", "C", "A"], this test fails.
I have also tried
pm.expect(jsonData.value).to.eql(ev)
pm.expect(jsonData).to.eql(ev)
How can I just compare the values are all found?
Thanks. Desmond
Aucun commentaire:
Enregistrer un commentaire