所有documentation都没有使用async ...与堆栈溢出问题相同。
it('Create a customer', async () => {
const createCustomer = await Customer.create({ email: 'test@gmail.com' });
createCustomer.should.exist;
});
这是我的错误
2) Customers Server Create a customer:
TypeError: Cannot read property 'exist' of undefined
以下是导入,以防万一。
import { expect, should } from 'chai';
其他信息:'期待'确实有效。 '宜'没有。
答案 0 :(得分:0)
为了在断言链的开始使用should
,您将需要对其进行调用。约定是:
const should = chai.should()
或者,如文档中所写:
var should = require('chai').should() //actually call the function