7253-devToTest_2418 #2350
|
@ -1,38 +1,6 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Notification Send()', () => {
|
describe('Notification Send()', () => {
|
||||||
beforeAll(async() => {
|
|
||||||
await models.NotificationQueue.destroyAll();
|
|
||||||
await models.NotificationQueue.create(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
params: '{"id": "1"}',
|
|
||||||
status: 'pending',
|
|
||||||
created: '2000-12-31T23:00:00.000Z',
|
|
||||||
notificationFk: 'print-email',
|
|
||||||
authorFk: 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
params: '{"id": "2"}',
|
|
||||||
status: 'pending',
|
|
||||||
created: '2000-12-31T23:00:00.000Z',
|
|
||||||
notificationFk: 'print-email',
|
|
||||||
authorFk: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
params: null,
|
|
||||||
status: 'pending',
|
|
||||||
created: '2000-12-31T23:00:00.000Z',
|
|
||||||
notificationFk: 'print-email',
|
|
||||||
authorFk: null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should send notification', async() => {
|
it('should send notification', async() => {
|
||||||
const statusPending = 'pending';
|
const statusPending = 'pending';
|
||||||
const tx = await models.NotificationQueue.beginTransaction({});
|
const tx = await models.NotificationQueue.beginTransaction({});
|
||||||
|
|
|
@ -8,9 +8,17 @@ describe('Operator', () => {
|
||||||
const sentStatus = 'sent';
|
const sentStatus = 'sent';
|
||||||
|
|
||||||
beforeEach(async() => {
|
beforeEach(async() => {
|
||||||
await models.NotificationQueue.destroyAll({notificationFk: notificationName});
|
await deleteNotification();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await deleteNotification();
|
||||||
|
});
|
||||||
|
|
||||||
|
async function deleteNotification() {
|
||||||
|
await models.NotificationQueue.destroyAll({notificationFk: notificationName});
|
||||||
|
}
|
||||||
|
|
||||||
async function updateOperatorAndFindNotification(labelerFk = labeler) {
|
async function updateOperatorAndFindNotification(labelerFk = labeler) {
|
||||||
await models.Operator.updateAll({id: authorFk}, {workerFk: authorFk, labelerFk: labelerFk, sectorFk: sectorId});
|
await models.Operator.updateAll({id: authorFk}, {workerFk: authorFk, labelerFk: labelerFk, sectorFk: sectorId});
|
||||||
return models.NotificationQueue.findOne({order: 'id DESC'});
|
return models.NotificationQueue.findOne({order: 'id DESC'});
|
||||||
|
|
Loading…
Reference in New Issue