corrected some typos
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2022-02-08 09:27:39 +01:00
parent 00f8946675
commit 4f1d34069b
2 changed files with 20 additions and 20 deletions

View File

@ -58,11 +58,11 @@ export default class Controller extends Section {
} }
toggleGroupingMode(buy, mode) { toggleGroupingMode(buy, mode) {
const groupingFk = 1; const grouping = 1;
const packingFk = 2; const packing = 2;
const grouingMode = mode === 'grouping' ? groupingFk : packingFk; const groupingMode = mode === 'grouping' ? grouping : packing;
const newGroupingMode = buy.groupingMode === grouingMode ? 0 : grouingMode; const newGroupingMode = buy.groupingMode === groupingMode ? 0 : groupingMode;
const params = { const params = {
groupingMode: newGroupingMode groupingMode: newGroupingMode

View File

@ -68,45 +68,45 @@ describe('Entry buy', () => {
describe('toggleGroupingMode()', () => { describe('toggleGroupingMode()', () => {
it(`should toggle grouping mode from grouping to packing`, () => { it(`should toggle grouping mode from grouping to packing`, () => {
const groupingFk = 1; const grouping = 1;
const packingFk = 2; const packing = 2;
const buy = {id: 999, groupingMode: groupingFk}; const buy = {id: 999, groupingMode: grouping};
const query = `Buys/${buy.id}`; const query = `Buys/${buy.id}`;
$httpBackend.expectPATCH(query, {groupingMode: packingFk}).respond(200); $httpBackend.expectPATCH(query, {groupingMode: packing}).respond(200);
controller.toggleGroupingMode(buy, 'packing'); controller.toggleGroupingMode(buy, 'packing');
$httpBackend.flush(); $httpBackend.flush();
}); });
it(`should toggle grouping mode from packing to grouping`, () => { it(`should toggle grouping mode from packing to grouping`, () => {
const groupingFk = 1; const grouping = 1;
const packingFk = 2; const packing = 2;
const buy = {id: 999, groupingMode: packingFk}; const buy = {id: 999, groupingMode: packing};
const query = `Buys/${buy.id}`; const query = `Buys/${buy.id}`;
$httpBackend.expectPATCH(query, {groupingMode: groupingFk}).respond(200); $httpBackend.expectPATCH(query, {groupingMode: grouping}).respond(200);
controller.toggleGroupingMode(buy, 'grouping'); controller.toggleGroupingMode(buy, 'grouping');
$httpBackend.flush(); $httpBackend.flush();
}); });
it(`should toggle off the grouping mode if it was packing to packing`, () => { it(`should toggle off the grouping mode if it was packing to packing`, () => {
const noGroupingFk = 0; const noGrouping = 0;
const packingFk = 2; const packing = 2;
const buy = {id: 999, groupingMode: packingFk}; const buy = {id: 999, groupingMode: packing};
const query = `Buys/${buy.id}`; const query = `Buys/${buy.id}`;
$httpBackend.expectPATCH(query, {groupingMode: noGroupingFk}).respond(200); $httpBackend.expectPATCH(query, {groupingMode: noGrouping}).respond(200);
controller.toggleGroupingMode(buy, 'packing'); controller.toggleGroupingMode(buy, 'packing');
$httpBackend.flush(); $httpBackend.flush();
}); });
it(`should toggle off the grouping mode if it was grouping to grouping`, () => { it(`should toggle off the grouping mode if it was grouping to grouping`, () => {
const noGroupingFk = 0; const noGrouping = 0;
const groupingFk = 1; const grouping = 1;
const buy = {id: 999, groupingMode: groupingFk}; const buy = {id: 999, groupingMode: grouping};
const query = `Buys/${buy.id}`; const query = `Buys/${buy.id}`;
$httpBackend.expectPATCH(query, {groupingMode: noGroupingFk}).respond(200); $httpBackend.expectPATCH(query, {groupingMode: noGrouping}).respond(200);
controller.toggleGroupingMode(buy, 'grouping'); controller.toggleGroupingMode(buy, 'grouping');
$httpBackend.flush(); $httpBackend.flush();
}); });