Skip to content

Commit b134676

Browse files
committed
Check that full reCAPTCHA script URL was assigned to script element
1 parent 1483f41 commit b134676

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

packages/analytics/src/helpers.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ describe('Gtag wrapping functions', () => {
6767
insertScriptTag(customDataLayerName, fakeMeasurementId);
6868
const scriptTag = findGtagScriptOnPage(customDataLayerName);
6969
expect(scriptTag).to.not.be.null;
70-
expect(scriptTag!.src).to.equal(`https://www.googletagmanager.com/gtag/js?l=${customDataLayerName}&id=${fakeMeasurementId}`);
70+
expect(scriptTag!.src).to.equal(
71+
`https://www.googletagmanager.com/gtag/js?l=${customDataLayerName}&id=${fakeMeasurementId}`
72+
);
7173
});
7274

7375
// The test above essentially already touches this functionality but it is still valuable

packages/app-check/src/recaptcha.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ import {
3030
initializeV3,
3131
initializeEnterprise,
3232
getToken,
33-
GreCAPTCHATopLevel
33+
GreCAPTCHATopLevel,
34+
RECAPTCHA_ENTERPRISE_URL,
35+
RECAPTCHA_URL
3436
} from './recaptcha';
3537
import * as utils from './util';
3638
import {
@@ -81,7 +83,9 @@ describe('recaptcha', () => {
8183

8284
expect(findgreCAPTCHAScriptsOnPage().length).to.equal(0);
8385
await initializeV3(app, FAKE_SITE_KEY);
84-
expect(findgreCAPTCHAScriptsOnPage().length).to.equal(1);
86+
const greCATPCHAScripts = findgreCAPTCHAScriptsOnPage();
87+
expect(greCATPCHAScripts.length).to.equal(1);
88+
expect(greCATPCHAScripts[0].src).to.equal(RECAPTCHA_URL);
8589
});
8690

8791
it('creates invisible widget', async () => {
@@ -128,7 +132,9 @@ describe('recaptcha', () => {
128132

129133
expect(findgreCAPTCHAScriptsOnPage().length).to.equal(0);
130134
await initializeEnterprise(app, FAKE_SITE_KEY);
131-
expect(findgreCAPTCHAScriptsOnPage().length).to.equal(1);
135+
const greCAPTCHAScripts = findgreCAPTCHAScriptsOnPage();
136+
expect(greCAPTCHAScripts.length).to.equal(1);
137+
expect(greCAPTCHAScripts[0].src).to.equal(RECAPTCHA_ENTERPRISE_URL);
132138
});
133139

134140
it('creates invisible widget', async () => {

0 commit comments

Comments
 (0)