From 834ae43585356e4544bd899ba0805448f976b721 Mon Sep 17 00:00:00 2001 From: Jethro Nederhof Date: Fri, 11 Oct 2024 13:18:48 +1100 Subject: [PATCH] Fix GA cookies unit tests broken by #1349 (#1353) --- .../test/__snapshots__/ga-cookies.test.ts.snap | 7 ++++--- plugins/browser-plugin-ga-cookies/test/ga-cookies.test.ts | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/browser-plugin-ga-cookies/test/__snapshots__/ga-cookies.test.ts.snap b/plugins/browser-plugin-ga-cookies/test/__snapshots__/ga-cookies.test.ts.snap index fff2ed783..6ec8c8107 100644 --- a/plugins/browser-plugin-ga-cookies/test/__snapshots__/ga-cookies.test.ts.snap +++ b/plugins/browser-plugin-ga-cookies/test/__snapshots__/ga-cookies.test.ts.snap @@ -157,14 +157,15 @@ Array [ ] `; -exports[`GA Cookies plugin Returns values for Universal Analytics cookies by default 1`] = ` +exports[`GA Cookies plugin Returns values for GA4 cookies by default 1`] = ` Array [ Object { "data": Object { - "__utma": "567", "_ga": "1234", + "cookie_prefix": undefined, + "session_cookies": undefined, }, - "schema": "iglu:com.google.analytics/cookies/jsonschema/1-0-0", + "schema": "iglu:com.google.ga4/cookies/jsonschema/1-0-0", }, ] `; diff --git a/plugins/browser-plugin-ga-cookies/test/ga-cookies.test.ts b/plugins/browser-plugin-ga-cookies/test/ga-cookies.test.ts index 6e82c5ec3..168d30065 100644 --- a/plugins/browser-plugin-ga-cookies/test/ga-cookies.test.ts +++ b/plugins/browser-plugin-ga-cookies/test/ga-cookies.test.ts @@ -21,7 +21,7 @@ describe('GA Cookies plugin', () => { jest.clearAllMocks(); }); - it('Returns values for Universal Analytics cookies by default', (done) => { + it('Returns values for GA4 cookies by default', (done) => { const containerId = '1234'; document.cookie = `_ga=1234; __utma=567; _ga_${containerId}=567;`; const core = trackerCore({ @@ -42,7 +42,7 @@ describe('GA Cookies plugin', () => { const measurementId = `G-${containerId}`; document.cookie = ``; const core = trackerCore({ - corePlugins: [GaCookiesPlugin({ ga4: true, ga4MeasurementId: measurementId })], + corePlugins: [GaCookiesPlugin({ ua: true, ga4MeasurementId: measurementId })], callback: (payloadBuilder) => { const { data } = payloadBuilder.getJson()[1].json; expect(data).toMatchSnapshot(); @@ -58,7 +58,7 @@ describe('GA Cookies plugin', () => { const measurementId = `G-${containerId}`; document.cookie = `_ga=1234; __utma=567; _ga_${containerId}=567;`; const core = trackerCore({ - corePlugins: [GaCookiesPlugin({ ga4: true, ga4MeasurementId: measurementId })], + corePlugins: [GaCookiesPlugin({ ua: true, ga4MeasurementId: measurementId })], callback: (payloadBuilder) => { const { data } = payloadBuilder.getJson()[1].json; expect(data).toMatchSnapshot();