2023-01-24 08:04:43 +00:00
|
|
|
const {models} = require('vn-loopback/server/server');
|
2019-11-13 11:18:30 +00:00
|
|
|
|
2021-02-01 08:29:47 +00:00
|
|
|
describe('Chat send()', () => {
|
2022-06-03 11:36:21 +00:00
|
|
|
it('should return true as response', async() => {
|
2019-11-13 11:18:30 +00:00
|
|
|
let ctx = {req: {accessToken: {userId: 1}}};
|
2023-01-24 08:04:43 +00:00
|
|
|
let response = await models.Chat.send(ctx, '@salesPerson', 'I changed something');
|
2019-11-13 11:18:30 +00:00
|
|
|
|
2022-04-11 12:43:20 +00:00
|
|
|
expect(response).toEqual(true);
|
2019-11-13 11:18:30 +00:00
|
|
|
});
|
2019-11-14 07:16:52 +00:00
|
|
|
|
2022-06-03 11:36:21 +00:00
|
|
|
it('should return false as response', async() => {
|
2019-11-14 07:16:52 +00:00
|
|
|
let ctx = {req: {accessToken: {userId: 18}}};
|
2023-01-24 08:04:43 +00:00
|
|
|
let response = await models.Chat.send(ctx, '@salesPerson', 'I changed something');
|
2019-11-14 07:16:52 +00:00
|
|
|
|
2022-04-11 12:43:20 +00:00
|
|
|
expect(response).toEqual(false);
|
2019-11-14 07:16:52 +00:00
|
|
|
});
|
2019-11-13 11:18:30 +00:00
|
|
|
});
|