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};
args: {
from: today,
}
};
let result = await app.models.Route.filter(ctx); try {
const from = new Date();
from.setHours(0, 0, 0, 0);
expect(result.length).toEqual(7); const to = new Date();
}); to.setHours(23, 59, 59, 999);
it('should return the routes matching "to"', async() => { const ctx = {
let ctx = { args: {
args: { from: from,
to: today, 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);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
}); });
it('should return the routes matching "m3"', async() => { it('should return the routes matching "m3"', async() => {