From d92598a4c3860d01b399bae709794e2d75d4d8ce Mon Sep 17 00:00:00 2001 From: Rahul Gupta Date: Fri, 8 Nov 2024 19:02:54 +0530 Subject: [PATCH] Added unit tests --- test/features/cdt/cdt.test.js | 12 ++++++++++++ .../personalization/mocks/head-schedule.html | 2 +- test/features/personalization/promo-utils.test.js | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/test/features/cdt/cdt.test.js b/test/features/cdt/cdt.test.js index cbe87c91cf..b51b954b41 100644 --- a/test/features/cdt/cdt.test.js +++ b/test/features/cdt/cdt.test.js @@ -60,3 +60,15 @@ describe('CDT test start is equal to end date', () => { expect(container.querySelectorAll('.timer-label')).to.have.lengthOf(0); }); }); + +describe('CDT test start is equal to end date', () => { + before(() => { + document.head.innerHTML = ''; + }); + it('check for countdown-timer meta data by MEP', async () => { + const container = document.getElementById('cdt-container'); + await loadCDT(container, container.classList); + expect(container.querySelectorAll('.timer-label')).to.have.lengthOf(1); + container.innerHTML = ''; + }); +}); diff --git a/test/features/personalization/mocks/head-schedule.html b/test/features/personalization/mocks/head-schedule.html index 594275aba9..1507b6ad60 100644 --- a/test/features/personalization/mocks/head-schedule.html +++ b/test/features/personalization/mocks/head-schedule.html @@ -1,6 +1,6 @@ - + diff --git a/test/features/personalization/promo-utils.test.js b/test/features/personalization/promo-utils.test.js index abdcc2745e..f9fb26dffc 100644 --- a/test/features/personalization/promo-utils.test.js +++ b/test/features/personalization/promo-utils.test.js @@ -76,6 +76,8 @@ describe('getPromoManifests', () => { name: 'bf-us', start: new Date('2000-11-01T00:00:00.000Z'), end: new Date('2300-12-15T00:00:00.000Z'), + cdtEnd: undefined, + cdtStart: undefined, }, }, { @@ -85,6 +87,8 @@ describe('getPromoManifests', () => { name: 'pre-black-friday-global', start: new Date('2000-11-01T00:00:00.000Z'), end: new Date('2300-12-15T00:00:00.000Z'), + cdtEnd: undefined, + cdtStart: undefined, }, }, { @@ -94,6 +98,8 @@ describe('getPromoManifests', () => { name: 'black-friday-global', start: new Date('2000-12-15T00:00:00.000Z'), end: new Date('2000-12-31T00:00:00.000Z'), + cdtEnd: '2026-08-30T00:00:00', + cdtStart: '2024-08-26T12:00:00', }, }, ];