Skip to content

Commit

Permalink
removed ucv2 tests as not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
mirafedas committed Jan 28, 2025
1 parent fa061bb commit 40e1011
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 71 deletions.
68 changes: 0 additions & 68 deletions test/blocks/merch/merch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import merch, {
PRICE_TEMPLATE_OPTICAL,
PRICE_TEMPLATE_STRIKETHROUGH,
PRICE_TEMPLATE_ANNUAL,
CHECKOUT_ALLOWED_KEYS,
buildCta,
getCheckoutContext,
initService,
Expand Down Expand Up @@ -409,18 +408,6 @@ describe('Merch Block', () => {
expect(dataset.promotionCode).to.equal('nicopromo');
});

it('renders merch link to UCv2 cta with link-level overrides', async () => {
const el = await merch(document.querySelector(
'.merch.cta.link-overrides',
));
const { nodeName, dataset } = await el.onceSettled();
expect(nodeName).to.equal('A');
expect(el.getAttribute('is')).to.equal('checkout-link');
// https://wiki.corp.adobe.com/pages/viewpage.action?spaceKey=BPS&title=UCv2+Link+Creation+Guide
expect(dataset.checkoutWorkflow).to.equal('UCv2');
expect(dataset.checkoutWorkflowStep).to.equal('checkout');
expect(dataset.checkoutMarketSegment).to.equal('EDU');
});

it('adds ims country to checkout link', async () => {
await mockIms('CH');
Expand Down Expand Up @@ -869,61 +856,6 @@ describe('Merch Block', () => {
});
});

describe('checkout link with optional params', async () => {
const checkoutUcv2Keys = [
'rurl', 'authCode', 'curl',
];
const checkoutAllowKeysMapping = {
quantity: 'q',
checkoutPromoCode: 'apc',
ctxrturl: 'ctxRtUrl',
country: 'co',
language: 'lang',
clientId: 'cli',
context: 'ctx',
productArrangementCode: 'pa',
offerType: 'ot',
marketSegment: 'ms',
authCode: 'code',
rurl: 'rUrl',
curl: 'cUrl',
};
const segmentation = [
'ot',
'pa',
'ms',
];

const keyValueMapping = { lang: 'en', ms: 'COM', ot: 'BASE', pa: 'phsp_direct_individual' };

const skipKeys = ['quantity', 'co', 'country', 'lang', 'language'];

CHECKOUT_ALLOWED_KEYS.forEach((key) => {
if (skipKeys.includes(key)) return;
const mappedKey = checkoutAllowKeysMapping[key] ?? key;
it(`renders checkout link with "${mappedKey}" parameter`, async () => {
const a = document.createElement('a', { is: 'checkout-link' });
a.classList.add('merch');
const searchParams = new URLSearchParams();
searchParams.set('osi', 1);
searchParams.set('type', 'checkoutUrl');
if (checkoutUcv2Keys.includes(key)) {
searchParams.set('workflow', 'ucv2');
}
const value = keyValueMapping[mappedKey] ?? 'test';
searchParams.set(key, value);
if (segmentation.includes(mappedKey)) {
searchParams.set('workflowStep', 'segmentation');
}
a.setAttribute('href', `/tools/ost?${searchParams.toString()}`);
document.body.appendChild(a);
const el = await merch(a);
await el.onceSettled();
expect(el.getAttribute('href')).to.match(new RegExp(`https://commerce.adobe.com/.*${mappedKey}=${value}`));
el.remove();
});
});
});

describe('locale settings', () => {
it('should map correct commerce locale', async () => {
Expand Down
3 changes: 0 additions & 3 deletions test/blocks/merch/mocks/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ <h2>CTAs</h2>
<p>CTA with metadata default: <a class="merch cta metadata"
href="/tools/ost?osi=16&type=checkoutUrl">CTA Buy Now</a>
</p>
<p>CTA with link-level overrides: <a class="merch cta link-overrides"
href="/tools/ost?osi=17&type=checkoutUrl&workflow=UCv2&workflowStep=checkout_email&marketSegment=EDU">CTA Buy Now</a>
</p>


<p class="marquee">Large CTA inside a marquee: <a class="merch cta inside-marquee"
Expand Down

0 comments on commit 40e1011

Please sign in to comment.