Uncaught AssertionError: .empty was passed non-string primitive 1
Uncaught AssertionError: .empty was passed non-string primitive 1
当我给出如下语句时,抛出 "Uncaught AssertionError: .empty was passed non-string primitive 1"
expect(res.body.invoiceDetails.lineItems[0].invLineId).to.be.a('Number').and.not.to.be.empty;
尝试 not.to.be.null
而不是 not.to.be.empty
根据 chai 文档,.empty 检查天气 array 是否为空或者 string 的长度是否为 0:
.empty
When the target is a string or array, .empty asserts that the target’s
length property is strictly (===) equal to 0.
您似乎希望 'res.body.invoiceDetails.lineItems[0].invLineId' 是一个数字,因此断言失败了。
当我给出如下语句时,抛出 "Uncaught AssertionError: .empty was passed non-string primitive 1" expect(res.body.invoiceDetails.lineItems[0].invLineId).to.be.a('Number').and.not.to.be.empty;
尝试 not.to.be.null
而不是 not.to.be.empty
根据 chai 文档,.empty 检查天气 array 是否为空或者 string 的长度是否为 0:
.empty
When the target is a string or array, .empty asserts that the target’s length property is strictly (===) equal to 0.
您似乎希望 'res.body.invoiceDetails.lineItems[0].invLineId' 是一个数字,因此断言失败了。