included test
This commit is contained in:
parent
1094bbe92b
commit
14eacec0ff
|
@ -1,4 +1,5 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('Route filter()', () => {
|
||||
let today = new Date();
|
||||
|
@ -17,29 +18,33 @@ describe('Route filter()', () => {
|
|||
expect(result[0].id).toEqual(1);
|
||||
});
|
||||
|
||||
// #1428 cuadrar formato de horas
|
||||
xit('should return the routes matching "from"', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
from: today,
|
||||
}
|
||||
};
|
||||
it('should return results matching "from" and "to"', async() => {
|
||||
const tx = await models.Buy.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
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() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
to: today,
|
||||
}
|
||||
};
|
||||
const ctx = {
|
||||
args: {
|
||||
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);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return the routes matching "m3"', async() => {
|
||||
|
|
Loading…
Reference in New Issue