docbrown/app/javascript/packs/__tests__/billboard.test.js
Anna Buianova 89b3b8127e
Rename display ads to billboards: css and js code (#19887)
* Renamed js vars/css names

* Renamed display_ads to billboards in js functions, variables, components
2023-08-04 17:30:59 +03:00

23 lines
771 B
JavaScript

import { getBillboard } from '../billboard';
describe('getBillboard', () => {
beforeEach(() => {
global.Honeybadger = { notify: jest.fn() };
document.body.innerHTML = `
<div>
<div class="js-billboard-container" data-async-url="/billboards/sidebar_left"></div>
<div class="js-billboard-container" data-async-url="/billboards/sidebar_left_2"></div>
</div>
`;
});
test('should make a call to the correct placement url', async () => {
const fetchPromise = Promise.resolve('fetch response');
window.fetch = jest.fn(fetchPromise);
await getBillboard();
expect(window.fetch).toHaveBeenCalledWith('/billboards/sidebar_left');
expect(window.fetch).toHaveBeenCalledWith('/billboards/sidebar_left_2');
});
});