#1819 fixtures
This commit is contained in:
parent
f78fec42cc
commit
bdbadaf61a
|
@ -351,16 +351,6 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
|
|||
(2, 2, 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
|
||||
(3, 3, 10000, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL);
|
||||
|
||||
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`)
|
||||
VALUES
|
||||
(1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 7, 'first route', 2.7, 10, CURDATE(), CURDATE()),
|
||||
(2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 7, 'second route', 0.9, 20, CURDATE(), CURDATE()),
|
||||
(3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 7, 'third route', 1.1, 30, CURDATE(), CURDATE()),
|
||||
(4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 7, 'fourth route', 0.1, 40, CURDATE(), CURDATE()),
|
||||
(5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 8, 'fifth route', NULL, 50, CURDATE(), CURDATE()),
|
||||
(6, NULL, 57, CURDATE(), 5, 8, 'sixth route', NULL, 60, CURDATE(), CURDATE()),
|
||||
(7, NULL, 57, CURDATE(), 6, NULL, 'seventh route', NULL, 70, CURDATE(), CURDATE());
|
||||
|
||||
INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`)
|
||||
VALUES
|
||||
(1, 'Wayne Industries');
|
||||
|
@ -456,32 +446,42 @@ INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `t
|
|||
(12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 4, 4, 0, 0, 0),
|
||||
(13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 5, 0, 0, 0);
|
||||
|
||||
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`)
|
||||
VALUES
|
||||
(1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', 1.8, 10, CURDATE(), CURDATE(), 1),
|
||||
(2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 2, 'second route', 0.2, 20, CURDATE(), CURDATE(), 9),
|
||||
(3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 3, 'third route', 0.5, 30, CURDATE(), CURDATE(), 10),
|
||||
(4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 4, 'fourth route', 0, 40, CURDATE(), CURDATE(), 12),
|
||||
(5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 5, 'fifth route', 0.1, 50, CURDATE(), CURDATE(), 13),
|
||||
(6, NULL, 57, CURDATE(), 5, 7, 'sixth route', 1.7, 60, CURDATE(), CURDATE(), 3),
|
||||
(7, NULL, 57, CURDATE(), 6, 8, 'seventh route', 0, 70, CURDATE(), CURDATE(), 5);
|
||||
|
||||
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `created`)
|
||||
VALUES
|
||||
(1 , 3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Bat cave', 121, 'T1111111', 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(2 , 1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T1111111', 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(3 , 1, 7, 1, 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T2222222', 0, 3, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
(4 , 3, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T3333333', 0, 9, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
||||
(5 , 3, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T4444444', 0, 10, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
|
||||
(6 , 1, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(7 , NULL, 7, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Mountain Drive Gotham', 1, NULL, 0, 3, CURDATE()),
|
||||
(8 , NULL, 7, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Bat cave', 121, NULL, 0, 3, CURDATE()),
|
||||
(9 , NULL, 7, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Stark tower', 124, NULL, 0, 3, CURDATE()),
|
||||
(10, 1, 1, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'Ingram Street', 2, NULL, 0, 11, CURDATE()),
|
||||
(11, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'NY roofs', 122, NULL, 0, 3, CURDATE()),
|
||||
(12, 1, 1, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
|
||||
(13, 1, 7, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
|
||||
(14, 1, 2, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
|
||||
(15, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()),
|
||||
(16, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
|
||||
(17, 1, 7, 2, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
|
||||
(18, 1, 4, 4, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),
|
||||
(3 , 1, 7, 1, 6, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T2222222', 0, 3, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
(4 , 3, 2, 1, 2, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T3333333', 0, 9, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
||||
(5 , 3, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T4444444', 0, 10, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
|
||||
(6 , 1, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(7 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Mountain Drive Gotham', 1, NULL, 0, 3, CURDATE()),
|
||||
(8 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Bat cave', 121, NULL, 0, 3, CURDATE()),
|
||||
(9 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Stark tower', 124, NULL, 0, 3, CURDATE()),
|
||||
(10, 1, 1, 5, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'Ingram Street', 2, NULL, 0, 1, CURDATE()),
|
||||
(11, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'NY roofs', 122, NULL, 0, 3, CURDATE()),
|
||||
(12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
|
||||
(13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()),
|
||||
(14, 1, 2, 1, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
|
||||
(15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()),
|
||||
(16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
|
||||
(17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
|
||||
(18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),
|
||||
(19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()),
|
||||
(20, 1, 5, 5, 3, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(21, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Holland', 102, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(22, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Japan', 103, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(23, NULL, 10, 1, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'address 21', 121, NULL, 0, 8, CURDATE()),
|
||||
(24 ,NULL, 10, 1, NULL, CURDATE(), CURDATE(), 101, 'Bruce Wayne', 1, NULL, 0, 8, CURDATE());
|
||||
(21, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Holland', 102, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(22, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Japan', 103, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(23, NULL, 8, 1, 7, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'address 21', 121, NULL, 0, 5, CURDATE()),
|
||||
(24 ,NULL, 8, 1, 7, CURDATE(), CURDATE(), 101, 'Bruce Wayne', 1, NULL, 0, 5, CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
||||
VALUES
|
||||
|
|
|
@ -358,7 +358,7 @@ describe('Worker time control path', () => {
|
|||
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
|
||||
const wholeWeekHours = await nightmare
|
||||
.waitToClick(selectors.workerTimeControl.nextMonthButton)
|
||||
.waitToClick(selectors.workerTimeControl.nextMonthButton)
|
||||
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 Hours')
|
||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
||||
|
||||
expect(wholeWeekHours).toEqual('00:00 Hours');
|
||||
|
|
|
@ -30,6 +30,7 @@ describe('Ticket Edit basic data path', () => {
|
|||
|
||||
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
|
||||
const disabled = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
|
|
|
@ -117,6 +117,6 @@ describe('Route filter()', () => {
|
|||
|
||||
let result = await app.models.Route.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(4);
|
||||
expect(result.length).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,6 +4,6 @@ describe('route getTickets()', () => {
|
|||
it('should return the tickets for a given route', async() => {
|
||||
let result = await app.models.Route.getTickets(2);
|
||||
|
||||
expect(result.length).toEqual(4);
|
||||
expect(result.length).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('route guessPriority()', () => {
|
||||
const targetRouteId = 2;
|
||||
const targetRouteId = 7;
|
||||
let routeTicketsToRestore;
|
||||
|
||||
afterAll(async done => {
|
||||
|
@ -17,25 +17,23 @@ describe('route guessPriority()', () => {
|
|||
it('should confirm the tickets in the target route have no priority yet', async() => {
|
||||
routeTicketsToRestore = await app.models.Ticket.find({where: {routeFk: targetRouteId}});
|
||||
|
||||
expect(routeTicketsToRestore.length).toEqual(4);
|
||||
expect(routeTicketsToRestore.length).toEqual(2);
|
||||
|
||||
expect(routeTicketsToRestore[0].id).toEqual(23);
|
||||
expect(routeTicketsToRestore[0].priority).toBeNull();
|
||||
expect(routeTicketsToRestore[0].id).toEqual(7);
|
||||
expect(routeTicketsToRestore[1].id).toEqual(24);
|
||||
expect(routeTicketsToRestore[1].priority).toBeNull();
|
||||
expect(routeTicketsToRestore[1].id).toEqual(8);
|
||||
expect(routeTicketsToRestore[2].priority).toBeNull();
|
||||
expect(routeTicketsToRestore[2].id).toEqual(9);
|
||||
});
|
||||
|
||||
it('should call guessPriority() and then check the tickets in the target route now have their priorities defined', async() => {
|
||||
await app.models.Route.guessPriority(targetRouteId);
|
||||
let routeTickets = await app.models.Ticket.find({where: {routeFk: targetRouteId}, fields: ['id', 'priority']});
|
||||
|
||||
expect(routeTickets.length).toEqual(4);
|
||||
expect(routeTickets[0].priority).toEqual(1);
|
||||
expect(routeTickets[0].id).toEqual(7);
|
||||
expect(routeTickets[1].priority).toEqual(3);
|
||||
expect(routeTickets[1].id).toEqual(8);
|
||||
expect(routeTickets[2].priority).toEqual(2);
|
||||
expect(routeTickets[2].id).toEqual(9);
|
||||
expect(routeTickets.length).toEqual(2);
|
||||
|
||||
expect(routeTickets[0].id).toEqual(23);
|
||||
expect(routeTickets[0].priority).toEqual(3);
|
||||
expect(routeTickets[1].id).toEqual(24);
|
||||
expect(routeTickets[1].priority).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('route summary()', () => {
|
|||
const result = await app.models.Route.summary(1);
|
||||
const agency = result.route.agencyMode();
|
||||
|
||||
expect(agency.name).toEqual('Silla247');
|
||||
expect(agency.name).toEqual('inhouse pickup');
|
||||
});
|
||||
|
||||
it(`should return a summary object containing it's vehicle`, async() => {
|
||||
|
@ -31,6 +31,6 @@ describe('route summary()', () => {
|
|||
it(`should return a summary object containing data from the tickets`, async() => {
|
||||
const result = await app.models.Route.summary(2);
|
||||
|
||||
expect(result.tickets.length).toEqual(4);
|
||||
expect(result.tickets.length).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,8 +10,8 @@ describe('route updateVolume()', () => {
|
|||
|
||||
|
||||
afterAll(async done => {
|
||||
await originalRoute.updateAttributes({m3: 2.7});
|
||||
await ticketToRestore.updateAttributes({routeFk: 2});
|
||||
await originalRoute.updateAttributes({m3: 1.8});
|
||||
await ticketToRestore.updateAttributes({routeFk: null});
|
||||
await app.models.RouteLog.destroyById(logIdToDestroy);
|
||||
done();
|
||||
});
|
||||
|
@ -19,12 +19,12 @@ describe('route updateVolume()', () => {
|
|||
it('should confirm the original volume of the route is the expected', async() => {
|
||||
originalRoute = await app.models.Route.findById(routeId);
|
||||
|
||||
expect(originalRoute.m3).toEqual(2.7);
|
||||
expect(originalRoute.m3).toEqual(1.8);
|
||||
});
|
||||
|
||||
it('should confirm the route volume is updated when a ticket is added', async() => {
|
||||
ticketToRestore = await app.models.Ticket.findById(8);
|
||||
let updatedTicket = await app.models.Ticket.findById(8);
|
||||
ticketToRestore = await app.models.Ticket.findById(14);
|
||||
let updatedTicket = await app.models.Ticket.findById(14);
|
||||
|
||||
await updatedTicket.updateAttributes({routeFk: routeId});
|
||||
await app.models.Route.updateVolume(ctx, routeId);
|
||||
|
@ -36,8 +36,9 @@ describe('route updateVolume()', () => {
|
|||
|
||||
it('should confirm the change is logged', async() => {
|
||||
let logs = await app.models.RouteLog.find({fields: ['id', 'newInstance']});
|
||||
|
||||
let m3Log = logs.filter(log => {
|
||||
return log.newInstance.m3 === 3.1;
|
||||
return log.newInstance.m3 === 1.9;
|
||||
});
|
||||
logIdToDestroy = m3Log[0].id;
|
||||
|
||||
|
|
Loading…
Reference in New Issue