2022-02-23 11:07:05 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2020-01-20 10:59:15 +00:00
|
|
|
|
2021-02-01 08:29:47 +00:00
|
|
|
describe('Chat sendCheckingPresence()', () => {
|
2022-06-03 11:36:21 +00:00
|
|
|
it('should return true as response', async() => {
|
|
|
|
const workerId = 1107;
|
2020-01-20 10:59:15 +00:00
|
|
|
|
2022-06-03 11:36:21 +00:00
|
|
|
let ctx = {req: {accessToken: {userId: 1}}};
|
|
|
|
let response = await models.Chat.sendCheckingPresence(ctx, workerId, 'I changed something');
|
2020-10-06 08:15:27 +00:00
|
|
|
|
2022-06-03 11:36:21 +00:00
|
|
|
expect(response).toEqual(true);
|
2020-01-20 10:59:15 +00:00
|
|
|
});
|
|
|
|
|
2022-06-03 11:36:21 +00:00
|
|
|
it('should return false as response', async() => {
|
|
|
|
const salesPersonId = 18;
|
2022-02-23 11:07:05 +00:00
|
|
|
|
2022-06-03 11:36:21 +00:00
|
|
|
let ctx = {req: {accessToken: {userId: 18}}};
|
|
|
|
let response = await models.Chat.sendCheckingPresence(ctx, salesPersonId, 'I changed something');
|
2022-02-23 11:07:05 +00:00
|
|
|
|
2022-06-03 11:36:21 +00:00
|
|
|
expect(response).toEqual(false);
|
2020-01-20 10:59:15 +00:00
|
|
|
});
|
|
|
|
});
|