Skip to content

Commit

Permalink
Add test case for bootstrapper js
Browse files Browse the repository at this point in the history
  • Loading branch information
bandana147 committed Jul 23, 2024
1 parent bd618fd commit 67cf5dc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/navigation/bootstrapper.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { readFile } from '@web/test-runner-commands';
import { expect } from '@esm-bundle/chai';
import sinon from 'sinon';
import loadBlock from '../../libs/navigation/bootstrapper.js';

document.body.innerHTML = await readFile({ path: './mocks/body.html' });

const blockConfig = {
name: 'global-footer',
targetEl: 'footer',
appendType: 'appendChild',
footer: { authoringPath: '/federal/home', privacyLoadDelay: 0 },
};

const miloConfigs = {
origin: 'https://feds--milo--adobecom.hlx.page',
miloLibs: 'https://feds--milo--adobecom.hlx.page/libs',
pathname: '/',
};

describe('Bootstrapper', async () => {
it('Renders the footer block', async () => {
await loadBlock(miloConfigs, blockConfig);
const clock = sinon.useFakeTimers({
toFake: ['setTimeout'],
shouldAdvanceTime: true,
});
clock.tick(3000);
const el = document.getElementsByTagName('footer');
expect(el).to.exist;
});
});

0 comments on commit 67cf5dc

Please sign in to comment.