fix(item): add ng-model, add fixture and transaction back test
This commit is contained in:
parent
df6d547ad9
commit
adf295ebf3
|
@ -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
|
||||||
|
|
|
@ -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 tx = await models.Item.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const result = await models.Item.activeWithBuyer(filter);
|
const result = await models.Item.activeWithBuyer(filter, options);
|
||||||
const firstWorker = result[0];
|
const firstWorker = result[0];
|
||||||
const secondWorker = result[1];
|
const secondWorker = result[1];
|
||||||
|
|
||||||
expect(result.length).toEqual(2);
|
expect(result.length).toEqual(2);
|
||||||
expect(firstWorker.nickname).toEqual('logisticBossNick');
|
expect(firstWorker.nickname).toEqual('logisticBossNick');
|
||||||
expect(secondWorker.nickname).toEqual('buyerNick');
|
expect(secondWorker.nickname).toEqual('buyerNick');
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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}"
|
||||||
|
|
Loading…
Reference in New Issue