this is my message.test.js file.
var expect = require('expect');
var {generateMessage} = require('./message');
describe('generateMessage', () => {
it('should generate correct message object', () => {
var from = 'Jen';
var text = 'Some message';
var message = generateMessage(from, text);
expect(message.createdAt).toBeA('number');
expect(message).toInclude({from, text});
});
});
ERROR: priya@priya-pro:~/node-chat-app$ npm test
[email protected] test /home/priya/node-chat-app mocha server/**/*.test.js generateMessage 1) should generate correct message object
0 passing (12ms) 1 failing
1) generateMessage should generate correct message object: TypeError: expect(...).toBeA is not a function at Context.it (server/utils/message.test.js:12:31)
npm ERR! Test failed. See above for more details.
Help me...
.toBe
instead of.toBeA
? – Claybournemessage.createdAt
return number instead of string. – Claybourne