Javascript “与柴一起测试”;“应该存在”;不使用异步
所有的应用程序都不使用异步。。。堆栈溢出问题也是如此Javascript “与柴一起测试”;“应该存在”;不使用异步,javascript,chai,Javascript,Chai,所有的应用程序都不使用异步。。。堆栈溢出问题也是如此 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
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';
其他信息:“expect”确实有效“应该”不可用。为了在断言链的开头使用
Should
,您需要调用它。公约是:
const should = chai.should()
或者,如文件所述:
var should = require('chai').should() //actually call the function
为了在断言链的开头使用
should
,您需要调用它。公约是:
const should = chai.should()
或者,如文件所述:
var should = require('chai').should() //actually call the function