2019-11-13 11:18:30 +00:00
|
|
|
const app = require('vn-loopback/server/server');
|
|
|
|
|
|
|
|
describe('chat sendMessage()', () => {
|
2019-11-14 07:16:52 +00:00
|
|
|
it('should return a "Fake notification sent" as response', async() => {
|
2019-11-13 11:18:30 +00:00
|
|
|
let ctx = {req: {accessToken: {userId: 1}}};
|
|
|
|
let response = await app.models.Chat.sendMessage(ctx, '@salesPerson', 'I changed something');
|
|
|
|
|
|
|
|
expect(response.statusCode).toEqual(200);
|
|
|
|
expect(response.message).toEqual('Fake notification sent');
|
|
|
|
});
|
2019-11-14 07:16:52 +00:00
|
|
|
|
|
|
|
it('should not return a response', async() => {
|
|
|
|
let ctx = {req: {accessToken: {userId: 18}}};
|
|
|
|
let response = await app.models.Chat.sendMessage(ctx, '@salesPerson', 'I changed something');
|
|
|
|
|
|
|
|
expect(response).toBeUndefined();
|
|
|
|
});
|
2019-11-13 11:18:30 +00:00
|
|
|
});
|