diff --git a/test/blocks/floating-buttons/floating-buttons.test.js b/test/blocks/floating-buttons/floating-buttons.test.js index 0edcabeef..2aa5609f8 100644 --- a/test/blocks/floating-buttons/floating-buttons.test.js +++ b/test/blocks/floating-buttons/floating-buttons.test.js @@ -11,14 +11,28 @@ const { default: decorate } = imports[1]; const testBody = await readFile({ path: './mocks/body.html' }); const testBody2 = await readFile({ path: './mocks/body-paragraphed.html' }); +function mockPricingPlans() { + window.pricingPlans = {}; + document.querySelectorAll('a[href*="commerce.adobe.com"]').forEach((a) => { + window.pricingPlans[a.href] = { + url: a.href, + country: 'us', + language: 'en', + offerId: 'CFB1B7F391F77D02FE858C43C4A5C64F', + }; + }); +} + describe('Floating buttons', () => { beforeEach(() => { window.isTestEnv = true; window.placeholders = {}; + window.pricingPlans = {}; }); it('loading the static state correctly', async () => { document.body.innerHTML = testBody; + mockPricingPlans(); const block = document.querySelector('.floating-buttons'); await decorate(block); expect(block).to.exist; @@ -26,6 +40,7 @@ describe('Floating buttons', () => { it('knows what to do when authors accidentally stacked the links', async () => { document.body.innerHTML = testBody2; + mockPricingPlans(); const block = document.querySelector('.floating-buttons'); await decorate(block); expect(block.querySelector('.button-container')).to.not.exist;