Skip to content

Commit

Permalink
add test for checkDomainsAndWarn
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenJ committed Sep 28, 2020
1 parent 4594b3c commit edf303a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ describe('load', () => {

expect(window.fathom.trackPageview.mock.calls.length).toBe(1);
});

it('warns when loading include domains which are not bare domains', () => {
window.console = {
warn: jest.fn()
};

const firstScript = document.createElement('script');
document.body.appendChild(firstScript);
Fathom.load('abcde123', {
url: 'https://bobheadxi.dev/fathom.js',
auto: false,
includedDomains: ['https://bobheadxi.dev']
});

expect(window.console.warn).toHaveBeenCalledWith(
'The include domain https://bobheadxi.dev might fail to work as intended as it begins with a transfer protocol (http://, https://), consider removing the protocol portion of the string.'
);
});
});

describe('trackPageview', () => {
Expand Down

0 comments on commit edf303a

Please sign in to comment.