javascript - 赛普拉斯中的未定义不可迭代(无法读取属性 Symbol(Symbol.iterator))
问题描述
` it.only("建议价格", () => {
const suggestedBidAmount = Math.floor(Math.random() * maxval) + minval;
const vehicleIdSuggestedPrice = "d42f516a867590633dd8a82cb2563437";
const platformIdSuggestPrice = "xxxxx";
cy.request({
method: "POST",
url: Cypress.env("apiHostForEndpoints") + "/suggest-price",
headers: {
Authorization: Cypress.env("token"),
"content-type": Cypress.env("contentType"),
},
body: {
id: vehicleIdSuggestedPrice,
bid: suggestedBidAmount,
auctionPlatformId: platformIdSuggestPrice,
auctionPlatformUserId: platformUserId,
},
failOnStatusCode: false,
}).then((res) => {
//Assertion for one by one
expect(res.status).to.eq(200);
expect(res.body.suggestedPrices[0].auctionPlatformVehicleId).to.be.equal(
vehicleIdSuggestedPrice
);
expect(res.body.suggestedPrices[0].status).contains("pending");
expect(res.body.suggestedPrices[0].amount).to.be.within(minval, maxval);
expect(res.body.suggestedPrices[0].auctionPlatformId).contains(
platformIdSuggestPrice
);
// Assertion in one time
for (const index of res.body.suggestedPrices) {
expect(res.body.suggestedPrices[index].amount).to.be.within(
minval,
maxval
);
}
assert
.isNotNull(res.amount, "is not null")
.and.isNotNull(res.body.id, "is not null")
.and.isNotNull(res.body.createdAt, "is not null");
});
}); `
你能告诉这个失败的原因吗?我添加了我的代码。因此,从 sc 可以看出,所有断言都通过了,但给出了以下错误: Undefined is not iterable (cannot read property Symbol(Symbol.iterator))
解决方案
推荐阅读
- sql - 如何在 SQL 中将字符串转换为日期时间
- python - 逐元素应用
- visual-studio-code - vscode 将光标移动到下一个突出显示的单词
- matlab - 如何初始化 Matlab 结构数组以进行增长?
- c++ - OpenCV C++ drawContours 错误
- javascript - 计时器和本地存储问题
- r - 从 R 中整个数据帧的行中查找配对值
- javascript - 使用 casperjs 连接到 whatsappweb
- django - DJANGO,DRF:request id 返回 NONE 值而不是用户对象
- css - 为什么 CSS 混合模式会被 jquery 插件 fullPage.js 覆盖?