@@ -74,61 +74,6 @@ describe("LoginView", () => {
7474 } ) ;
7575 } ) ;
7676
77- describe ( "PostHog Integration" , ( ) => {
78- it ( "should call posthog.identify with email after successful authentication" , async ( ) => {
79- const testEmail = "test@example.com" ;
80- mockAuthApi . loginOrSignup . mockResolvedValue ( {
81- cUserId : "user123" ,
82- isNewUser : false ,
83- email : testEmail ,
84- } ) ;
85-
86- render ( < LoginView /> ) ;
87-
88- // Simulate successful Google login
89- const {
90- useGoogleLogin,
91- } = require ( "@web/components/oauth/google/useGoogleLogin" ) ;
92- const mockUseGoogleLogin = useGoogleLogin as jest . Mock ;
93-
94- // Get the onSuccess callback from the mocked hook
95- const onSuccessCallback = mockUseGoogleLogin . mock . calls [ 0 ] [ 0 ] . onSuccess ;
96-
97- // Call the onSuccess callback with a mock OAuth code
98- await onSuccessCallback ( "mock-oauth-code" ) ;
99-
100- // Verify PostHog identify was called with correct parameters
101- expect ( mockIdentify ) . toHaveBeenCalledWith ( testEmail , {
102- email : testEmail ,
103- } ) ;
104- expect ( mockAuthApi . loginOrSignup ) . toHaveBeenCalledWith ( "mock-oauth-code" ) ;
105- } ) ;
106-
107- it ( "should call posthog.identify for new user signup" , async ( ) => {
108- const testEmail = "newuser@example.com" ;
109- mockAuthApi . loginOrSignup . mockResolvedValue ( {
110- cUserId : "new-user-id" ,
111- isNewUser : true ,
112- email : testEmail ,
113- } ) ;
114-
115- render ( < LoginView /> ) ;
116-
117- const {
118- useGoogleLogin,
119- } = require ( "@web/components/oauth/google/useGoogleLogin" ) ;
120- const mockUseGoogleLogin = useGoogleLogin as jest . Mock ;
121- const onSuccessCallback = mockUseGoogleLogin . mock . calls [ 0 ] [ 0 ] . onSuccess ;
122-
123- await onSuccessCallback ( "mock-oauth-code" ) ;
124-
125- // Verify PostHog identify was called for new user
126- expect ( mockIdentify ) . toHaveBeenCalledWith ( testEmail , {
127- email : testEmail ,
128- } ) ;
129- } ) ;
130- } ) ;
131-
13277 describe ( "Authentication Flow" , ( ) => {
13378 it ( "should call AuthApi.loginOrSignup with OAuth code" , async ( ) => {
13479 render ( < LoginView /> ) ;
0 commit comments