Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anantjain45823 committed Apr 14, 2024
1 parent 4164c8f commit 6da8195
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/v0/destinations/impact/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const populateProductProperties = (productsMapping, properties) => {
}
});
} else {
// Not providing product level mapping here as following are fetched from properties level and product level
// Not providing product level mapping here as following are fetched from properties level
const index = 1;
productProperties[getPropertyName('ItemBrand', index)] = brand;
productProperties[getPropertyName('ItemCategory', index)] = category;
Expand Down
14 changes: 10 additions & 4 deletions src/v0/destinations/impact/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('populateProductProperties', () => {
{ to: 'ItemPromoCode', from: 'PromoCode' },
{ to: 'ItemQuantity', from: 'Quantity' },
{ to: 'ItemSku', from: 'Sku' },
{ to: 'dummyRHS', from: 'dummyLHS' },
];
const properties = {
products: [
Expand All @@ -24,6 +25,7 @@ describe('populateProductProperties', () => {
PromoCode: 'PromoCode1',
Quantity: 1,
Sku: 'Sku1',
dummyLHS: 'DummyValue',
},
{
Brand: 'Brand2',
Expand All @@ -32,7 +34,6 @@ describe('populateProductProperties', () => {
Price: 20,
PromoCode: 'PromoCode2',
Quantity: 2,
Sku: 'Sku2',
},
],
brand: 'Brand3',
Expand Down Expand Up @@ -62,7 +63,7 @@ describe('populateProductProperties', () => {
ItemPrice2: 20,
ItemPromoCode2: 'PromoCode2',
ItemQuantity2: 2,
ItemSku2: 'Sku2',
dummyRHS1: 'DummyValue',
});
});

Expand Down Expand Up @@ -94,8 +95,13 @@ describe('populateProductProperties', () => {
ItemSku1: 'Sku3',
});
});
it('should return product properties with custom mappings from properties', () => {
const productsMapping = [{ from: 'dummy_LHS', to: 'dummy_RHS' }];
it('should return product properties with custom mappings', () => {
const productsMapping = [
{
from: 'dummy_LHS',
to: 'dummy_RHS',
},
];
const properties = {
products: [
{
Expand Down

0 comments on commit 6da8195

Please sign in to comment.