diff --git a/posthog/cdp/test/test_site_functions.py b/posthog/cdp/test/test_site_functions.py index ef018d924f582..0b6c0bc1bb8a6 100644 --- a/posthog/cdp/test/test_site_functions.py +++ b/posthog/cdp/test/test_site_functions.py @@ -72,7 +72,7 @@ def test_get_transpiled_function_basic(self): };return exports;})(); let processEvent = undefined; if ('onEvent' in source) { - processEvent = function processEvent(globals) { + processEvent = function processEvent(globals, posthog) { if (!('onEvent' in source)) { return; }; const inputs = buildInputs(globals); const filterGlobals = { ...globals.groups, ...globals.event, person: globals.person, inputs, pdi: { distinct_id: globals.event.distinct_id, person: globals.person } }; @@ -99,7 +99,7 @@ def test_get_transpiled_function_basic(self): } return { - processEvent: processEvent + processEvent: (globals) => processEvent(globals, posthog) } } @@ -135,7 +135,7 @@ def test_get_transpiled_function_with_filters(self): result = self.compile_and_run() - assert "console.log(event.event);" in result + assert "console.log(globals);" in result assert "const filterMatches = " in result assert '__getGlobal("event") == "$pageview"' in result assert "const filterMatches = !!(!!((__getGlobal" in result @@ -259,7 +259,7 @@ def test_get_transpiled_function_with_complex_filters(self): result = self.compile_and_run() - assert "console.log(event.event);" in result + assert "console.log(globals);" in result assert "const filterMatches = " in result assert '__getGlobal("event") == "$pageview"' in result assert "https://example.com" in result diff --git a/posthog/models/test/test_remote_config.py b/posthog/models/test/test_remote_config.py index fa03badeca141..b7fcdaba4b88e 100644 --- a/posthog/models/test/test_remote_config.py +++ b/posthog/models/test/test_remote_config.py @@ -677,7 +677,7 @@ def test_renders_js_including_site_functions(self): const source = (function () {let exports={};"use strict";;return exports;})(); let processEvent = undefined; if ('onEvent' in source) { - processEvent = function processEvent(globals) { + processEvent = function processEvent(globals, posthog) { if (!('onEvent' in source)) { return; }; const inputs = buildInputs(globals); const filterGlobals = { ...globals.groups, ...globals.event, person: globals.person, inputs, pdi: { distinct_id: globals.event.distinct_id, person: globals.person } }; @@ -704,7 +704,7 @@ def test_renders_js_including_site_functions(self): } return { - processEvent: processEvent + processEvent: (globals) => processEvent(globals, posthog) } } @@ -723,7 +723,7 @@ def test_renders_js_including_site_functions(self): const source = (function () {let exports={};"use strict";;return exports;})(); let processEvent = undefined; if ('onEvent' in source) { - processEvent = function processEvent(globals) { + processEvent = function processEvent(globals, posthog) { if (!('onEvent' in source)) { return; }; const inputs = buildInputs(globals); const filterGlobals = { ...globals.groups, ...globals.event, person: globals.person, inputs, pdi: { distinct_id: globals.event.distinct_id, person: globals.person } }; @@ -750,7 +750,7 @@ def test_renders_js_including_site_functions(self): } return { - processEvent: processEvent + processEvent: (globals) => processEvent(globals, posthog) } }