included test

This commit is contained in:
Vicent Llopis 2022-03-17 09:53:50 +01:00
parent 1094bbe92b
commit 14eacec0ff
1 changed files with 23 additions and 18 deletions

View File

@ -1,4 +1,5 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
const models = require('vn-loopback/server/server').models;
describe('Route filter()', () => { describe('Route filter()', () => {
let today = new Date(); let today = new Date();
@ -17,29 +18,33 @@ describe('Route filter()', () => {
expect(result[0].id).toEqual(1); expect(result[0].id).toEqual(1);
}); });
// #1428 cuadrar formato de horas it('should return results matching "from" and "to"', async() => {
xit('should return the routes matching "from"', async() => { const tx = await models.Buy.beginTransaction({});
let ctx = { const options = {transaction: tx};
try {
const from = new Date();
from.setHours(0, 0, 0, 0);
const to = new Date();
to.setHours(23, 59, 59, 999);
const ctx = {
args: { args: {
from: today, from: from,
to: to
} }
}; };
let result = await app.models.Route.filter(ctx); const results = await models.Route.filter(ctx, options);
expect(result.length).toEqual(7); expect(results.length).toBe(7);
});
it('should return the routes matching "to"', async() => { await tx.rollback();
let ctx = { } catch (e) {
args: { await tx.rollback();
to: today, throw e;
} }
};
let result = await app.models.Route.filter(ctx);
expect(result.length).toEqual(7);
}); });
it('should return the routes matching "m3"', async() => { it('should return the routes matching "m3"', async() => {