fix: refs #7917 fix tback
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
d93de48c45
commit
839475a669
|
@ -5,6 +5,14 @@ describe('AgencyTerm filter()', () => {
|
||||||
const today = Date.vnNew();
|
const today = Date.vnNew();
|
||||||
today.setHours(2, 0, 0, 0);
|
today.setHours(2, 0, 0, 0);
|
||||||
let ctx = beforeAll.getCtx();
|
let ctx = beforeAll.getCtx();
|
||||||
|
beforeAll(async() => {
|
||||||
|
ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {},
|
||||||
|
headers: {origin: 'http://localhost'},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
it('should return all results matching the filter', async() => {
|
it('should return all results matching the filter', async() => {
|
||||||
const tx = await models.AgencyTerm.beginTransaction({});
|
const tx = await models.AgencyTerm.beginTransaction({});
|
||||||
|
|
|
@ -1,35 +1,51 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('route summary()', () => {
|
describe('route summary()', () => {
|
||||||
|
let ctx = beforeAll.getCtx();
|
||||||
|
beforeAll(async() => {
|
||||||
|
ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {},
|
||||||
|
headers: {origin: 'http://localhost'},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
it('should return a summary object containing data from one route', async() => {
|
it('should return a summary object containing data from one route', async() => {
|
||||||
const result = await app.models.Route.summary(ctx, 1);
|
const filter = {
|
||||||
|
id: 1
|
||||||
|
};
|
||||||
|
const result = await app.models.Route.summary(ctx, filter);
|
||||||
|
|
||||||
expect(result.route.id).toEqual(1);
|
expect(result.route.id).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should return a summary object containing it's agency`, async() => {
|
it(`should return a summary object containing it's agency`, async() => {
|
||||||
const result = await app.models.Route.summary(ctx, 1);
|
const filter = {
|
||||||
|
id: 1
|
||||||
|
};
|
||||||
|
const result = await app.models.Route.summary(ctx, filter);
|
||||||
const agency = result.route.agencyMode();
|
const agency = result.route.agencyMode();
|
||||||
|
|
||||||
expect(agency.name).toEqual('inhouse pickup');
|
expect(agency.name).toEqual('inhouse pickup');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should return a summary object containing it's vehicle`, async() => {
|
it(`should return a summary object containing it's vehicle`, async() => {
|
||||||
const result = await app.models.Route.summary(ctx, 1);
|
const result = await app.models.Route.summary(ctx, filter);
|
||||||
const vehicle = result.route.vehicle();
|
const vehicle = result.route.vehicle();
|
||||||
|
|
||||||
expect(vehicle.numberPlate).toEqual('3333-BAT');
|
expect(vehicle.numberPlate).toEqual('3333-BAT');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should return a summary object containing it's worker`, async() => {
|
it(`should return a summary object containing it's worker`, async() => {
|
||||||
const result = await app.models.Route.summary(ctx, 1);
|
const result = await app.models.Route.summary(ctx, filter);
|
||||||
const worker = result.route.worker().user();
|
const worker = result.route.worker().user();
|
||||||
|
|
||||||
expect(worker.name).toEqual('delivery');
|
expect(worker.name).toEqual('delivery');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should return a summary object containing data from the tickets`, async() => {
|
it(`should return a summary object containing data from the tickets`, async() => {
|
||||||
const result = await app.models.Route.summary(ctx, 2);
|
const result = await app.models.Route.summary(ctx, filter);
|
||||||
|
|
||||||
expect(result.tickets.length).toEqual(1);
|
expect(result.tickets.length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue