Skip to content

Commit

Permalink
Fix GA cookies unit tests broken by #1349 (#1353)
Browse files Browse the repository at this point in the history
  • Loading branch information
jethron authored Oct 11, 2024
1 parent 759f88d commit 834ae43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
]
`;
6 changes: 3 additions & 3 deletions plugins/browser-plugin-ga-cookies/test/ga-cookies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 834ae43

Please sign in to comment.