我在Expect()上应用了toBeA()方法,它给出了错误 TypeError:无法读取未定义的属性“ toBeA” 。如何通过链接应用这些方法。
utils.test.js代码
const expect = require('expect');
const utils = require('./utils');
it('should add two numbers',() => {
var res = utils.add(44,11);
expect(res).toBe(55).toBeA('number'); ----> here it gives the above error.
});
it('Object should be equal',() => {
expect([1,2,5,7]).toInclude(5); ---> here it gives the error TypeError: expect(...).toInclude is not a function
});
utils.js代码
module.exports.add = (a, b) => a + b ;
如何解决此问题?