import { RECAPTCHA_API_URL_PREFIX, RECAPTCHA_ONLOAD_CALLBACK_NAME, clearMemoizeCache, initRecaptchaScript, } from '~/captcha/init_recaptcha_script'; describe('initRecaptchaScript', () => { afterEach(() => { document.head.innerHTML = ''; clearMemoizeCache(); }); const getScriptOnload = () => window[RECAPTCHA_ONLOAD_CALLBACK_NAME]; const triggerScriptOnload = () => window[RECAPTCHA_ONLOAD_CALLBACK_NAME](); describe('when called', () => { let result; beforeEach(() => { result = initRecaptchaScript(); }); it('adds script to head', () => { expect(document.head).toMatchInlineSnapshot(`