Skip to content

Commit

Permalink
chore: updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepdsvs committed Feb 21, 2025
1 parent 28066ad commit 1f21962
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ describe('GoogleTagManager', () => {
const config = {
containerID: 'DUMMY_CONTAINER_ID',
serverUrl: 'DUMMY_SERVER_URL',
environmentID: 'env-2',
authorizationToken: 'random',
};
const analytics = {
logLevel: 'debug',
Expand Down Expand Up @@ -44,7 +46,12 @@ describe('GoogleTagManager', () => {
describe('init', () => {
it('should call loadNativeSdk with containerID and serverUrl', () => {
googleTagManager.init();
expect(loadNativeSdk).toHaveBeenCalledWith(config.containerID, config.serverUrl);
expect(loadNativeSdk).toHaveBeenCalledWith(
config.containerID,
config.serverUrl,
config.environmentID,
config.authorizationToken,
);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function loadNativeSdk(containerID, serverUrl, environmentID, authorizationToken
const f = d.getElementsByTagName(s)[0];
const j = d.createElement(s);
const dl = l !== 'dataLayer' ? `&l=${l}` : '';
const gtmEnv = environmentID ? `&gtm_preview=env-${encodeURIComponent(environmentID)}` : '';
const gtmEnv = environmentID ? `&gtm_preview=${encodeURIComponent(environmentID)}` : '';
const gtmAuth = authorizationToken ? `&gtm_auth=${encodeURIComponent(authorizationToken)}` : '';
const gtmCookies = '&gtm_cookies_win=x';
j.setAttribute('data-loader', LOAD_ORIGIN);
Expand Down

0 comments on commit 1f21962

Please sign in to comment.