fix(item): add ng-model, add fixture and transaction back test

This commit is contained in:
Alex Moreno 2021-11-15 12:14:34 +01:00
parent df6d547ad9
commit adf295ebf3
3 changed files with 19 additions and 8 deletions

View File

@ -814,7 +814,7 @@ INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `d
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT'), (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT'),
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'), (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'),
(16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'), (16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'),
(71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT'); (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT');
-- Update the taxClass after insert of the items -- Update the taxClass after insert of the items
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2 UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2

View File

@ -2,13 +2,23 @@ const models = require('vn-loopback/server/server').models;
describe('Worker activeWithBuyer', () => { describe('Worker activeWithBuyer', () => {
it('should return the buyers in itemType as result', async() => { it('should return the buyers in itemType as result', async() => {
const filter = {}; const tx = await models.Item.beginTransaction({});
const result = await models.Item.activeWithBuyer(filter);
const firstWorker = result[0];
const secondWorker = result[1];
expect(result.length).toEqual(2); try {
expect(firstWorker.nickname).toEqual('logisticBossNick'); const options = {transaction: tx};
expect(secondWorker.nickname).toEqual('buyerNick'); const filter = {};
const result = await models.Item.activeWithBuyer(filter, options);
const firstWorker = result[0];
const secondWorker = result[1];
expect(result.length).toEqual(2);
expect(firstWorker.nickname).toEqual('logisticBossNick');
expect(secondWorker.nickname).toEqual('buyerNick');
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
}); });
}); });

View File

@ -41,6 +41,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
disabled="false" disabled="false"
ng-model="filter.salesPersonFk"
url="Items/activeWithBuyer" url="Items/activeWithBuyer"
show-field="nickname" show-field="nickname"
search-function="{firstName: $search}" search-function="{firstName: $search}"