Skip to content

Commit

Permalink
Unit test for GRM/PEP interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmrj committed Jun 3, 2024
1 parent 6ff3c98 commit 2d0ee33
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/features/webapp-prompt/webapp-prompt.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from '@esm-bundle/chai';
import sinon, { stub } from 'sinon';
import pepPromptContent from './mocks/pep-prompt-content.js';
import { getConfig } from '../../../libs/utils/utils.js';

describe('PEP', () => {
let clock;
Expand Down Expand Up @@ -91,6 +92,22 @@ describe('PEP', () => {
await clock.runAllAsync();
expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist;
});

it('should not render PEP when the GRM is open', async () => {
const config = getConfig();
config.grmActive = true;
document.body.insertAdjacentHTML('afterbegin', '<div class="locale-modal-v2"></div>');
document.body.insertAdjacentHTML('afterbegin', '<div class="locale-modal"></div>');
await initPep({});
clock.next();
expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist;
document.querySelector('.locale-modal-v2')?.remove();
clock.next();
expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist;
document.querySelector('locale-modal')?.remove();
await clock.runAllAsync();
expect(document.querySelector(allSelectors.pepWrapper)).to.exist;
});
});

describe('PEP configuration tests', () => {
Expand Down

0 comments on commit 2d0ee33

Please sign in to comment.