Updated unit test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
8aa9918d84
commit
0a542a2057
|
@ -1,21 +1,23 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('item lastEntriesFilter()', () => {
|
describe('item lastEntriesFilter()', () => {
|
||||||
|
const minDate = new Date(value);
|
||||||
|
minHour.setHours(0, 0, 0, 0);
|
||||||
|
const maxDate = new Date(value);
|
||||||
|
maxHour.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
it('should return one entry for a given item', async() => {
|
it('should return one entry for a given item', async() => {
|
||||||
let date = new Date();
|
const filter = {where: {itemFk: 1, landed: {between: [minDate, maxDate]}}};
|
||||||
let filter = {where: {itemFk: 1, date: date}};
|
const result = await app.models.Item.lastEntriesFilter(filter);
|
||||||
let result = await app.models.Item.lastEntriesFilter(filter);
|
|
||||||
|
|
||||||
expect(result.length).toEqual(1);
|
expect(result.length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return five entries for a given item', async() => {
|
it('should return five entries for a given item', async() => {
|
||||||
let date = new Date();
|
minDate.setMonth(minDate.getMonth() - 2, 1);
|
||||||
|
|
||||||
date.setMonth(date.getMonth() - 2, 1);
|
const filter = {where: {itemFk: 1, landed: {between: [minDate, maxDate]}}};
|
||||||
|
const result = await app.models.Item.lastEntriesFilter(filter);
|
||||||
let filter = {where: {itemFk: 1, date: date}};
|
|
||||||
let result = await app.models.Item.lastEntriesFilter(filter);
|
|
||||||
|
|
||||||
expect(result.length).toEqual(5);
|
expect(result.length).toEqual(5);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue