diff --git a/packages/consent/consent-tools/src/domain/analytics/__tests__/get-initialized-analytics.test.ts b/packages/consent/consent-tools/src/domain/analytics/__tests__/get-initialized-analytics.test.ts index 72a077787..b2d2b119c 100644 --- a/packages/consent/consent-tools/src/domain/analytics/__tests__/get-initialized-analytics.test.ts +++ b/packages/consent/consent-tools/src/domain/analytics/__tests__/get-initialized-analytics.test.ts @@ -5,7 +5,7 @@ beforeEach(() => { delete (window as any).foo }) -describe('getInitializedAnalytics', () => { +describe(getInitializedAnalytics, () => { it('should return the window.analytics object if the snippet user passes a stale reference', () => { ;(window as any).analytics = { initialized: true } const analytics = [] as any diff --git a/packages/consent/consent-tools/src/domain/analytics/get-initialized-analytics.ts b/packages/consent/consent-tools/src/domain/analytics/get-initialized-analytics.ts index f0e91ffb0..434ec1620 100644 --- a/packages/consent/consent-tools/src/domain/analytics/get-initialized-analytics.ts +++ b/packages/consent/consent-tools/src/domain/analytics/get-initialized-analytics.ts @@ -1,6 +1,9 @@ import { AnyAnalytics, MaybeInitializedAnalytics } from '../../types' /** + * Get possibly-initialized analytics. + * + * Reason: * There is a known bug for people who attempt to to wrap the library: the analytics reference does not get updated when the analytics.js library loads. * Thus, we need to proxy events to the global reference instead. *