【发布时间】:2021-03-08 17:05:28
【问题描述】:
我正在用 postman 编写基本 API 测试,我不知道为什么我收到这两个测试的错误消息,消息是相同的:res.every 不是函数,forEach 不是函数
pm.test("All supplier users have uuid", function () {
const res = pm.response.json();
pm.expect(res.every(uuidIsDefined)).to.be.true;
});
pm.test("Every item has id an from ids[]", () => {
response = pm.response.json();
response.forEach(element => pm.expect(element.id).to.be.oneOf(ids));
});
【问题讨论】:
-
res和response不是数组。 -
不,它们确实是一个 json 对象,知道如何对 json 对象做同样的事情吗?
-
请添加您的回复
标签: javascript postman chai