Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vgoodric committed Oct 16, 2024
1 parent 4b6771b commit f920d67
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<meta name="target" content="gnav">
<meta name="target" content="postlcp">
<title>Document Title</title>
<link rel="icon" href="data:,">
4 changes: 2 additions & 2 deletions test/utils/utils-mep-gnav.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ describe('Utils - MEP GNav', () => {

it('have target be set to gnav and save in config', async () => {
window.fetch = sinon.stub().returns(htmlResponse());
document.head.innerHTML = await readFile({ path: './mocks/mep/head-target-gnav.html' });
document.head.innerHTML = await readFile({ path: './mocks/mep/head-target-postlcp.html' });
await utils.loadArea();
const resultConfig = utils.getConfig();
expect(resultConfig.mep.targetEnabled).to.equal('gnav');
expect(resultConfig.mep.targetEnabled).to.equal('postlcp');
});
});
});
4 changes: 2 additions & 2 deletions test/utils/utils-mep-with-params.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ describe('MEP Utils', () => {
describe('getMepEnablement', async () => {
it('checks param overwrites', async () => {
document.head.innerHTML = await readFile({ path: './mocks/mep/head-promo.html' });
spoofParams({ target: 'gnav', promo: 'off', personalization: 'off' });
spoofParams({ target: 'postlcp', promo: 'off', personalization: 'off' });
setTimeout(() => {
const persEnabled = getMepEnablement('personalization');
const promoEnabled = getMepEnablement('manifestnames', 'promo');
const targetEnabled = getMepEnablement('target');
expect(promoEnabled).to.equal(false);
expect(persEnabled).to.equal(false);
expect(targetEnabled).to.equal('gnav');
expect(targetEnabled).to.equal('postlcp');
}, 1000);
});
});
Expand Down
6 changes: 3 additions & 3 deletions test/utils/utils-mep.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ describe('MEP Utils', () => {
const targetEnabled = getMepEnablement('target');
expect(targetEnabled).to.equal(false);
});
it('checks target metadata set to gnav', async () => {
document.head.innerHTML = await readFile({ path: './mocks/mep/head-target-gnav.html' });
it('checks target metadata set to postlcp', async () => {
document.head.innerHTML = await readFile({ path: './mocks/mep/head-target-postlcp.html' });
const targetEnabled = getMepEnablement('target');
expect(targetEnabled).to.equal('gnav');
expect(targetEnabled).to.equal('postlcp');
});
it('checks from just metadata with no target metadata', async () => {
document.head.innerHTML = await readFile({ path: './mocks/mep/head-promo.html' });
Expand Down

0 comments on commit f920d67

Please sign in to comment.