24 lines
674 B
JavaScript
24 lines
674 B
JavaScript
|
import { navigateToLocalePage } from '../portalHelpers';
|
||
|
|
||
|
describe('#navigateToLocalePage', () => {
|
||
|
it('returns correct cookie name', () => {
|
||
|
const elemDiv = document.createElement('div');
|
||
|
elemDiv.classList.add('locale-switcher');
|
||
|
document.body.appendChild(elemDiv);
|
||
|
|
||
|
const allLocaleSwitcher = document.querySelector('.locale-switcher');
|
||
|
|
||
|
allLocaleSwitcher.addEventListener = jest
|
||
|
.fn()
|
||
|
.mockImplementationOnce((event, callback) => {
|
||
|
callback({ target: { value: 1 } });
|
||
|
});
|
||
|
|
||
|
navigateToLocalePage();
|
||
|
expect(allLocaleSwitcher.addEventListener).toBeCalledWith(
|
||
|
'change',
|
||
|
expect.any(Function)
|
||
|
);
|
||
|
});
|
||
|
});
|