update structure DB, fixturesDB and fix test
This commit is contained in:
parent
f330c77cc6
commit
aef4bfaf4f
|
@ -53,7 +53,7 @@ describe('Ticket', () => {
|
||||||
.wait(500)
|
.wait(500)
|
||||||
.waitToClick(selectors.ticketBasicData.addressSelect)
|
.waitToClick(selectors.ticketBasicData.addressSelect)
|
||||||
.waitToClick(selectors.ticketBasicData.addressSelectSecondOption)
|
.waitToClick(selectors.ticketBasicData.addressSelectSecondOption)
|
||||||
.waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles')
|
.waitForTextInInput(selectors.ticketBasicData.addressSelect, 'address 28')
|
||||||
.click(selectors.ticketBasicData.nextStepButton)
|
.click(selectors.ticketBasicData.nextStepButton)
|
||||||
.waitForURL('data/step-two')
|
.waitForURL('data/step-two')
|
||||||
.url()
|
.url()
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
USE `vn`;
|
||||||
|
CREATE
|
||||||
|
OR REPLACE ALGORITHM = UNDEFINED
|
||||||
|
DEFINER = `root`@`%`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `itemType` AS
|
||||||
|
SELECT
|
||||||
|
`t`.`tipo_id` AS `id`,
|
||||||
|
`t`.`Id_Tipo` AS `code`,
|
||||||
|
`t`.`Tipo` AS `name`,
|
||||||
|
`t`.`reino_id` AS `categoryFk`,
|
||||||
|
`t`.`life` AS `life`,
|
||||||
|
`t`.`Id_Trabajador` AS `workerFk`,
|
||||||
|
`t`.`warehouseFk` AS `warehouseFk`,
|
||||||
|
`t`.`isPackaging` AS `isPackaging`
|
||||||
|
FROM
|
||||||
|
`vn2008`.`Tipos` `t`;
|
|
@ -1,19 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
|
|
||||||
ALTER TABLE `vn2008`.`escritos`
|
|
||||||
ADD COLUMN `hasCompany` VARCHAR(45) NOT NULL DEFAULT 0 AFTER `visible`;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE
|
|
||||||
OR REPLACE ALGORITHM = UNDEFINED
|
|
||||||
DEFINER = `root`@`%`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `sample` AS
|
|
||||||
SELECT
|
|
||||||
`e`.`id` AS `id`,
|
|
||||||
`e`.`abrev` AS `code`,
|
|
||||||
`e`.`descripcion` AS `description`,
|
|
||||||
`e`.`visible` AS `isVisible`,
|
|
||||||
`e`.`hasCompany` AS `hasCompany`
|
|
||||||
FROM
|
|
||||||
`vn2008`.`escritos` `e`;
|
|
|
@ -1,13 +0,0 @@
|
||||||
USE `vn2008`;
|
|
||||||
|
|
||||||
ALTER TABLE `vn2008`.`reinos`
|
|
||||||
ADD COLUMN `icon` VARCHAR(45) NULL AFTER `mercancia`;
|
|
||||||
|
|
||||||
INSERT INTO `vn2008`.`reinos` (`reino`, `display`, `icon`) VALUES
|
|
||||||
('Handmade', '1', 'icon-handmade'),
|
|
||||||
('Artificial', '1', 'icon-artificial'),
|
|
||||||
('Green', '1', 'icon-greenery'),
|
|
||||||
('Accessories', '1', 'icon-accessory');
|
|
||||||
|
|
||||||
UPDATE `vn2008`.`reinos` SET `icon`='icon-plant' WHERE `id`=1;
|
|
||||||
UPDATE `vn2008`.`reinos` SET `icon`='icon-flower' WHERE `id`=2;
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,6 @@
|
||||||
|
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
|
||||||
|
ALTER TABLE `vn2008`.`Consignatarios` AUTO_INCREMENT = 1;
|
||||||
|
|
||||||
INSERT INTO `util`.`config` ( `dbVersion`, `hasTriggersDisabled`, `environment`)
|
INSERT INTO `util`.`config` ( `dbVersion`, `hasTriggersDisabled`, `environment`)
|
||||||
VALUES ('1.0.0', '0', 'development');
|
VALUES ('1.0.0', '0', 'development');
|
||||||
|
|
||||||
|
@ -426,11 +429,15 @@ INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `ma
|
||||||
VALUES
|
VALUES
|
||||||
(1, 102, 442, '1-1', CURDATE(), 2);
|
(1, 102, 442, '1-1', CURDATE(), 2);
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`)
|
INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Plant' , 1, 'B92A26'),
|
(1, 'Plant' , 1, 'B92A26', 'icon-plant'),
|
||||||
(2, 'Flower' , 2, 'dcf711'),
|
(2, 'Flower' , 2, 'dcf711', 'icon-flower'),
|
||||||
(3, 'Logistic', 0, 'b9f711');
|
(3, 'Logistic' , 0, 'b9f711', NULL),
|
||||||
|
(4, 'Handmade' , 1, NULL, 'icon-handmade'),
|
||||||
|
(5, 'Artificial' , 1, NULL, 'icon-artificial'),
|
||||||
|
(6, 'Green' , 1, NULL, 'icon-greenery'),
|
||||||
|
(7, 'Accessories', 1, NULL, 'icon-accessory');
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`, `isPackaging`)
|
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`, `isPackaging`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -596,7 +603,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||||
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
|
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
|
||||||
VALUES
|
VALUES
|
||||||
( 1, 0, CURDATE(), 5, 40, 3, 1, 14),
|
( 1, 0, CURDATE(), 5, 40, 3, 1, 14),
|
||||||
( 1, 1, CURDATE(), 5, 40, 3, 2, 14),
|
( 1, 1, CURDATE(), 5, 40, 3, 2, 8),
|
||||||
( 2, 1, CURDATE(), 10, 40, 4, 3, 8),
|
( 2, 1, CURDATE(), 10, 40, 4, 3, 8),
|
||||||
( 3, 1, CURDATE(), 2, 40, 4, 4, 8);
|
( 3, 1, CURDATE(), 2, 40, 4, 4, 8);
|
||||||
|
|
||||||
|
@ -859,11 +866,3 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina
|
||||||
( 2, 2, 1, 9, 5),
|
( 2, 2, 1, 9, 5),
|
||||||
( 3, 5, 2, 9, 5),
|
( 3, 5, 2, 9, 5),
|
||||||
( 4, 6, 3, 9, 5);
|
( 4, 6, 3, 9, 5);
|
||||||
|
|
||||||
INSERT INTO `vn`.`sample`(`id`, `code`, `description`, `isVisible`, `hasCompany`)
|
|
||||||
VALUES
|
|
||||||
(1, 'client-welcome', 'Client welcome email', 1, 0),
|
|
||||||
(2, 'printer-setup', 'Printer setup email', 1, 0),
|
|
||||||
(3, 'sepa-core', 'Direct debit email', 1, 1),
|
|
||||||
(4, 'letter-debtor-st', 'First debt email', 1, 1),
|
|
||||||
(5, 'letter-debtor-nd', 'Second debt email', 1, 1);
|
|
|
@ -2,14 +2,14 @@ const app = require(`${servicesDir}/item/server/server`);
|
||||||
|
|
||||||
describe('item updateTaxes()', () => {
|
describe('item updateTaxes()', () => {
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
let taxesInFixtures = [{id: 509368, taxClassFk: 1}];
|
let taxesInFixtures = [{id: 3, taxClassFk: 1}];
|
||||||
|
|
||||||
await app.models.Item.updateTaxes(taxesInFixtures);
|
await app.models.Item.updateTaxes(taxesInFixtures);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error if the taxClassFk is blank', async() => {
|
it('should throw an error if the taxClassFk is blank', async() => {
|
||||||
let error;
|
let error;
|
||||||
let taxes = [{id: 509368, taxClassFk: undefined}];
|
let taxes = [{id: 3, taxClassFk: undefined}];
|
||||||
|
|
||||||
await app.models.Item.updateTaxes(taxes)
|
await app.models.Item.updateTaxes(taxes)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
@ -21,11 +21,11 @@ describe('item updateTaxes()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update the tax of a given country of an item', async() => {
|
it('should update the tax of a given country of an item', async() => {
|
||||||
let taxCountry = await app.models.ItemTaxCountry.findById(509368);
|
let taxCountry = await app.models.ItemTaxCountry.findById(3);
|
||||||
|
|
||||||
expect(taxCountry.taxClassFk).toEqual(1);
|
expect(taxCountry.taxClassFk).toEqual(1);
|
||||||
|
|
||||||
let taxes = [{id: 509368, taxClassFk: 2}];
|
let taxes = [{id: 3, taxClassFk: 2}];
|
||||||
|
|
||||||
let result = await app.models.Item.updateTaxes(taxes);
|
let result = await app.models.Item.updateTaxes(taxes);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ describe('item updateTaxes()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the tax class was updated', async() => {
|
it('should confirm the tax class was updated', async() => {
|
||||||
let taxCountry = await app.models.ItemTaxCountry.findById(509368);
|
let taxCountry = await app.models.ItemTaxCountry.findById(3);
|
||||||
|
|
||||||
expect(taxCountry.taxClassFk).toEqual(2);
|
expect(taxCountry.taxClassFk).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('ticket new()', () => {
|
||||||
warehouseFk: 1,
|
warehouseFk: 1,
|
||||||
clientFk: 101,
|
clientFk: 101,
|
||||||
companyFk: 442,
|
companyFk: 442,
|
||||||
addressFk: 25516,
|
addressFk: 1,
|
||||||
agencyModeFk: 1,
|
agencyModeFk: 1,
|
||||||
userId: 9
|
userId: 9
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,8 +2,9 @@ const app = require(`${servicesDir}/client/server/server`);
|
||||||
|
|
||||||
describe('loopback model address', () => {
|
describe('loopback model address', () => {
|
||||||
let createdAddressId;
|
let createdAddressId;
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
let address = await app.models.Address.findById(25516);
|
let address = await app.models.Address.findById(1);
|
||||||
let client = await app.models.Client.findById(101);
|
let client = await app.models.Client.findById(101);
|
||||||
|
|
||||||
await address.updateAttribute('isDefaultAddress', true);
|
await address.updateAttribute('isDefaultAddress', true);
|
||||||
|
@ -13,9 +14,9 @@ describe('loopback model address', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('observe()', () => {
|
describe('observe()', () => {
|
||||||
it('should throw an error if the default consignee is unchecked', async() => {
|
it('should throw an error when deactivating a consignee if its the default address', async() => {
|
||||||
let error;
|
let error;
|
||||||
let address = await app.models.Address.findById(25516);
|
let address = await app.models.Address.findById(1);
|
||||||
|
|
||||||
await address.updateAttribute('isActive', false)
|
await address.updateAttribute('isActive', false)
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
@ -28,7 +29,7 @@ describe('loopback model address', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set isDefaultAddress to false of all the addresses for a given client', async() => {
|
it('should set isDefaultAddress to false of all the addresses for a given client', async() => {
|
||||||
let previousDefaultAddress = await app.models.Address.findById(25516);
|
let previousDefaultAddress = await app.models.Address.findById(1);
|
||||||
|
|
||||||
expect(previousDefaultAddress.isDefaultAddress).toBeTruthy();
|
expect(previousDefaultAddress.isDefaultAddress).toBeTruthy();
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ describe('loopback model address', () => {
|
||||||
|
|
||||||
expect(defaultAddress.isDefaultAddress).toBeTruthy();
|
expect(defaultAddress.isDefaultAddress).toBeTruthy();
|
||||||
|
|
||||||
let noLongerDefaultAddress = await app.models.Address.findById(25516);
|
let noLongerDefaultAddress = await app.models.Address.findById(1);
|
||||||
|
|
||||||
expect(noLongerDefaultAddress.isDefaultAddress).toBeFalsy();
|
expect(noLongerDefaultAddress.isDefaultAddress).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe('order new()', () => {
|
||||||
|
|
||||||
it('should throw an error if the client isnt frozen and isnt active', async() => {
|
it('should throw an error if the client isnt frozen and isnt active', async() => {
|
||||||
let error;
|
let error;
|
||||||
let params = {addressFk: 25521};
|
let params = {addressFk: 6};
|
||||||
|
|
||||||
await app.models.Order.new(params)
|
await app.models.Order.new(params)
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
@ -28,7 +28,7 @@ describe('order new()', () => {
|
||||||
|
|
||||||
it('should throw an error if the client isnt frozen and is active but doesnt have data checked', async() => {
|
it('should throw an error if the client isnt frozen and is active but doesnt have data checked', async() => {
|
||||||
let error;
|
let error;
|
||||||
let params = {addressFk: 25522};
|
let params = {addressFk: 7};
|
||||||
|
|
||||||
await app.models.Order.new(params)
|
await app.models.Order.new(params)
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
|
Loading…
Reference in New Issue