@@ -7,17 +7,24 @@ import { authMockFns } from '@sim/testing'
77import { dehydrate } from '@tanstack/react-query'
88import { renderToStaticMarkup } from 'react-dom/server'
99import { beforeEach , describe , expect , it , vi } from 'vitest'
10+ import { isChatEnabled } from '@/lib/core/config/env-flags'
1011
1112const {
1213 mockGetOrganizationSurfaceContext,
1314 mockWorkspaceChrome,
1415 mockPrefetchOrganizationSidebar,
1516 mockUseSession,
17+ mockUseMothershipChatEvents,
1618} = vi . hoisted ( ( ) => ( {
1719 mockGetOrganizationSurfaceContext : vi . fn ( ) ,
1820 mockWorkspaceChrome : vi . fn ( ( { children } : { children : ReactNode } ) => children ) ,
1921 mockPrefetchOrganizationSidebar : vi . fn ( async ( ) => undefined ) ,
2022 mockUseSession : vi . fn ( ) ,
23+ mockUseMothershipChatEvents : vi . fn ( ) ,
24+ } ) )
25+
26+ vi . mock ( '@/hooks/use-mothership-chat-events' , ( ) => ( {
27+ useMothershipChatEvents : mockUseMothershipChatEvents ,
2128} ) )
2229
2330vi . mock ( '@/lib/auth/auth-client' , ( ) => ( { useSession : mockUseSession } ) )
@@ -118,6 +125,10 @@ describe('OrganizationLayout', () => {
118125 'active-org'
119126 )
120127 expect ( html ) . toContain ( 'Organization child' )
128+ expect ( mockUseMothershipChatEvents ) . toHaveBeenCalledWith (
129+ { organizationId : 'org-1' } ,
130+ isChatEnabled
131+ )
121132 expect ( html ) . not . toContain ( 'Stop impersonating' )
122133 expect ( mockWorkspaceChrome ) . toHaveBeenCalledWith (
123134 expect . objectContaining ( { initialSidebarCollapsed : true } ) ,
0 commit comments