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'),
|
||||
(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'),
|
||||
(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 `vn`.`itemTaxCountry` SET `taxClassFk` = 2
|
||||
|
|
|
@ -2,13 +2,23 @@ const models = require('vn-loopback/server/server').models;
|
|||
|
||||
describe('Worker activeWithBuyer', () => {
|
||||
it('should return the buyers in itemType as result', async() => {
|
||||
const filter = {};
|
||||
const result = await models.Item.activeWithBuyer(filter);
|
||||
const firstWorker = result[0];
|
||||
const secondWorker = result[1];
|
||||
const tx = await models.Item.beginTransaction({});
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
expect(firstWorker.nickname).toEqual('logisticBossNick');
|
||||
expect(secondWorker.nickname).toEqual('buyerNick');
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
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;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
disabled="false"
|
||||
ng-model="filter.salesPersonFk"
|
||||
url="Items/activeWithBuyer"
|
||||
show-field="nickname"
|
||||
search-function="{firstName: $search}"
|
||||
|
|
Loading…
Reference in New Issue