test(salesfilter): updated unit test for sales filter
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
8623f914c7
commit
273086472a
|
@ -103,4 +103,40 @@ describe('SalesMonitor salesFilter()', () => {
|
|||
|
||||
expect(result.length).toEqual(4);
|
||||
});
|
||||
|
||||
it('should return the tickets sorted by problems descendant', async() => {
|
||||
const yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
yesterday.setHours(0, 0, 0, 0);
|
||||
const today = new Date();
|
||||
today.setHours(23, 59, 59, 59);
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 18}}, args: {}};
|
||||
const filter = {order: 'totalProblems DESC'};
|
||||
const result = await app.models.SalesMonitor.salesFilter(ctx, filter);
|
||||
|
||||
const firstTicket = result.shift();
|
||||
const secondTicket = result.shift();
|
||||
|
||||
expect(firstTicket.totalProblems).toEqual(3);
|
||||
expect(secondTicket.totalProblems).toEqual(2);
|
||||
});
|
||||
|
||||
it('should return the tickets sorted by problems ascendant', async() => {
|
||||
const yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
yesterday.setHours(0, 0, 0, 0);
|
||||
const today = new Date();
|
||||
today.setHours(23, 59, 59, 59);
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 18}}, args: {}};
|
||||
const filter = {order: 'totalProblems ASC'};
|
||||
const result = await app.models.SalesMonitor.salesFilter(ctx, filter);
|
||||
|
||||
const firstTicket = result.shift();
|
||||
const secondTicket = result.shift();
|
||||
|
||||
expect(firstTicket.totalProblems).toEqual(null);
|
||||
expect(secondTicket.totalProblems).toEqual(null);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue