Skip to content

Commit

Permalink
Added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulgupta999 committed Nov 8, 2024
1 parent d792560 commit d92598a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions test/features/cdt/cdt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<meta name="manifestnames" content="black-friday-offer,twp-cct"><meta name="schedule" content=", black-friday-offer | 2024-03-22T05:00:00 | 2038-03-31T05:00:00 | https://main--milo--adobecom.hlx.page/drafts/nala/features/promotions/manifests/promo-with-fragments-insert.json | | 2024-08-26T12:00:00 | 2026-08-30T00:00:00, mwpw-159157-delayed-modal-space-between | 2024-09-26T00:00:00 | 2026-11-30T00:00:00 | https://main--milo--adobecom.hlx.live/fragments/mirafedas/promos/2024/global/delayed-modal-promo/delayed-modal-promo.json | | |">';
});
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 = '';
});
});
2 changes: 1 addition & 1 deletion test/features/personalization/mocks/head-schedule.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<meta name="manifestnames" content="pre-black-friday-global,black-friday-global,cyber-monday,bf-us">
<meta name="emea_manifestnames" content="bf-de">
<meta name="americas_manifestnames" content="bf-us">
<meta name="schedule" content="pre-black-friday-global | 2000-11-01T00:00:00 | 2300-12-15T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/pre-black-friday/manifest-global.json, black-friday-global | 2000-12-15T00:00:00 | 2000-12-31T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/black-friday/manifest-global.json">
<meta name="schedule" content="pre-black-friday-global | 2000-11-01T00:00:00 | 2300-12-15T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/pre-black-friday/manifest-global.json, black-friday-global | 2000-12-15T00:00:00 | 2000-12-31T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/black-friday/manifest-global.json | | 2024-08-26T12:00:00 | 2026-08-30T00:00:00">
<meta name="emea_schedule" content="bf-de | 2000-11-01T00:00:00 | 2300-12-15T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/bf-de.json | de;ch, black-friday-de | 2000-12-15T00:00:00 | 2300-12-31T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/black-friday/manifest-de.json">
<meta name="americas_schedule" content="bf-us | 2000-11-01T00:00:00 | 2300-12-15T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/bf-us.json | ca;us, bf-ca | 2000-11-01T00:00:00 | 2300-12-15T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/bf-ca.json | ca,black-friday-us | 2000-12-15T00:00:00 | 2300-12-31T00:00:00 | https://main--milo--adobecom.hlx.page/promos/2023/black-friday/black-friday/manifest-us.json">
6 changes: 6 additions & 0 deletions test/features/personalization/promo-utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
{
Expand All @@ -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,
},
},
{
Expand All @@ -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',
},
},
];
Expand Down

0 comments on commit d92598a

Please sign in to comment.