Skip to content

Commit

Permalink
MWPW-139338: mocked ims for gnav.js unit tests (#1545)
Browse files Browse the repository at this point in the history
mocked ims for gnav.js unit tests
  • Loading branch information
robert-bogos authored Nov 16, 2023
1 parent 23f0e0d commit 5767cfd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/blocks/gnav/gnav.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ const config = { locales: { '': { ietf: 'en-US', tk: 'hah7vzn.css' } }, imsClien
setConfig(config);

describe('Gnav', () => {
before(() => {
window.adobeid = {
client_id: 'milo',
scope: 'gnav',
};
window.adobeIMS = { getAccessToken: () => false };
});

after(() => {
delete window.adobeid;
delete window.adobeIMS;
});

beforeEach(() => {
sinon.spy(console, 'log');
});
Expand All @@ -30,6 +43,7 @@ describe('Gnav', () => {

it('test wrong gnav', async () => {
gnav = await mod.default(document.querySelector('header'));
window.adobeid.onReady();
expect(gnav).to.be.not.null;
});

Expand Down
1 change: 1 addition & 0 deletions test/blocks/gnav/mocks/head.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<meta name="gnav-source" content="/test/blocks/gnav/mocks/gnav">
<link rel="stylesheet" href="/libs/blocks/gnav/gnav.css">
<script src="https://auth.services.adobe.com/imslib/imslib.min.js" type="javascript/blocked" data-loaded="true"></script>

0 comments on commit 5767cfd

Please sign in to comment.