Requested changes + e2e updated
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
be37334f49
commit
4c7d95f001
|
@ -41,6 +41,6 @@ describe('Entry lastest buys path', () => {
|
||||||
|
|
||||||
it('should navigate to the entry.buy section by clicking one of the buys', async() => {
|
it('should navigate to the entry.buy section by clicking one of the buys', async() => {
|
||||||
await page.waitToClick(selectors.entryLatestBuys.firstBuy);
|
await page.waitToClick(selectors.entryLatestBuys.firstBuy);
|
||||||
await page.waitForState('entry.card.buy');
|
await page.waitForState('entry.card.buy.index');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,11 +20,13 @@ describe('entry import()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should import the buy rows', async() => {
|
it('should import the buy rows', async() => {
|
||||||
|
const expectedRef = '1, 2';
|
||||||
|
const expectedObservation = '123456';
|
||||||
const ctx = {
|
const ctx = {
|
||||||
req: activeCtx,
|
req: activeCtx,
|
||||||
args: {
|
args: {
|
||||||
observation: '123456',
|
observation: expectedObservation,
|
||||||
ref: '1, 2',
|
ref: expectedRef,
|
||||||
buys: [
|
buys: [
|
||||||
{
|
{
|
||||||
itemFk: 1,
|
itemFk: 1,
|
||||||
|
@ -33,7 +35,8 @@ describe('entry import()', () => {
|
||||||
grouping: 1,
|
grouping: 1,
|
||||||
packing: 1,
|
packing: 1,
|
||||||
size: 1,
|
size: 1,
|
||||||
volume: 1200
|
volume: 1200,
|
||||||
|
packageFk: '94'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
itemFk: 4,
|
itemFk: 4,
|
||||||
|
@ -42,7 +45,8 @@ describe('entry import()', () => {
|
||||||
grouping: 1,
|
grouping: 1,
|
||||||
packing: 1,
|
packing: 1,
|
||||||
size: 25,
|
size: 25,
|
||||||
volume: 1125
|
volume: 1125,
|
||||||
|
packageFk: '94'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -66,8 +70,8 @@ describe('entry import()', () => {
|
||||||
where: {entryFk: newEntry.id}
|
where: {entryFk: newEntry.id}
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
expect(updatedEntry.observation).toEqual('123456');
|
expect(updatedEntry.observation).toEqual(expectedObservation);
|
||||||
expect(updatedEntry.ref).toEqual('1, 2');
|
expect(updatedEntry.ref).toEqual(expectedRef);
|
||||||
expect(entryBuys.length).toEqual(2);
|
expect(entryBuys.length).toEqual(2);
|
||||||
|
|
||||||
// Restores
|
// Restores
|
||||||
|
|
|
@ -12,6 +12,7 @@ describe('entry importBuysPreview()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the buys with the calculated packageFk', async() => {
|
it('should return the buys with the calculated packageFk', async() => {
|
||||||
|
const expectedPackageFk = '3';
|
||||||
const buys = [
|
const buys = [
|
||||||
{
|
{
|
||||||
itemFk: 1,
|
itemFk: 1,
|
||||||
|
@ -35,6 +36,6 @@ describe('entry importBuysPreview()', () => {
|
||||||
const randomIndex = Math.floor(Math.random() * result.length);
|
const randomIndex = Math.floor(Math.random() * result.length);
|
||||||
const buy = result[randomIndex];
|
const buy = result[randomIndex];
|
||||||
|
|
||||||
expect(buy.packageFk).toEqual('3');
|
expect(buy.packageFk).toEqual(expectedPackageFk);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -97,6 +97,23 @@ describe('Entry', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('onSubmit()', () => {
|
describe('onSubmit()', () => {
|
||||||
|
it(`should throw an error when some of the rows doesn't have an item`, () => {
|
||||||
|
jest.spyOn(controller.vnApp, 'showError');
|
||||||
|
|
||||||
|
controller.import = {
|
||||||
|
observation: '123456',
|
||||||
|
ref: '1, 2',
|
||||||
|
buys: [
|
||||||
|
{'buyingValue': 5.77, 'description': 'Bow', 'grouping': 1, 'packing': 1, 'size': 1, 'volume': 1200},
|
||||||
|
{'buyingValue': 2.16, 'description': 'Arrow', 'grouping': 1, 'packing': 1, 'size': 25, 'volume': 1125}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
controller.onSubmit();
|
||||||
|
|
||||||
|
expect(controller.vnApp.showError).toHaveBeenCalledWith(`Some of the imported buys doesn't have an item`);
|
||||||
|
});
|
||||||
|
|
||||||
it(`should perform a query to update columns`, () => {
|
it(`should perform a query to update columns`, () => {
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
controller.$state.go = jest.fn();
|
controller.$state.go = jest.fn();
|
||||||
|
@ -105,8 +122,8 @@ describe('Entry', () => {
|
||||||
observation: '123456',
|
observation: '123456',
|
||||||
ref: '1, 2',
|
ref: '1, 2',
|
||||||
buys: [
|
buys: [
|
||||||
{'buyingValue': 5.77, 'description': 'Bow', 'grouping': 1, 'packing': 1, 'size': 1, 'volume': 1200},
|
{'itemFk': 10, 'buyingValue': 5.77, 'description': 'Bow', 'grouping': 1, 'packing': 1, 'size': 1, 'volume': 1200},
|
||||||
{'buyingValue': 2.16, 'description': 'Arrow', 'grouping': 1, 'packing': 1, 'size': 25, 'volume': 1125}
|
{'itemFk': 11, 'buyingValue': 2.16, 'description': 'Arrow', 'grouping': 1, 'packing': 1, 'size': 25, 'volume': 1125}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
const params = controller.import;
|
const params = controller.import;
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<a ng-repeat="buy in $ctrl.buys"
|
<a ng-repeat="buy in $ctrl.buys"
|
||||||
class="clickable vn-tr search-result"
|
class="clickable vn-tr search-result"
|
||||||
ui-sref="entry.card.buy({id: {{::buy.entryFk}}})">
|
ui-sref="entry.card.buy.index({id: {{::buy.entryFk}}})">
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-check
|
<vn-check
|
||||||
ng-model="buy.checked"
|
ng-model="buy.checked"
|
||||||
|
|
Loading…
Reference in New Issue