@@ -46,10 +46,15 @@ jest.mock('../Presentation', () => ({
4646 default : ( { children } : { children : React . ReactNode } ) => < div > { children } </ div > ,
4747} ) ) ;
4848jest . mock ( '../Header' , ( ) => ( { __esModule : true , default : ( ) => < div /> } ) ) ;
49+ let mockConfiguredFooter = false ;
50+ let mockLandingFooter = true ;
4951jest . mock ( '../Footer' , ( ) => ( {
5052 __esModule : true ,
51- default : ( ) => < div /> ,
52- useConfiguredFooter : ( ) => false ,
53+ default : ( { configuredOnly } : { configuredOnly ?: boolean } ) => (
54+ < div data-testid = { configuredOnly ? 'configured-footer' : 'landing-footer' } />
55+ ) ,
56+ useConfiguredFooter : ( ) => mockConfiguredFooter ,
57+ useLandingFooter : ( ) => mockLandingFooter ,
5358} ) ) ;
5459jest . mock ( '../Landing' , ( ) => ( { __esModule : true , default : ( ) => < div /> } ) ) ;
5560jest . mock ( '~/components/Lia' , ( ) => ( { __esModule : true , default : ( ) => null } ) ) ;
@@ -213,3 +218,48 @@ describe('ChatView draft saving', () => {
213218 expect ( mockAskHostSaveDrafts ) . toHaveBeenLastCalledWith ( saveDrafts ) ;
214219 } ) ;
215220} ) ;
221+
222+ describe ( 'ChatView landing footer' , ( ) => {
223+ beforeEach ( ( ) => {
224+ mockParams . mockReturnValue ( { } ) ;
225+ mockConversation . mockReturnValue ( null ) ;
226+ mockConfiguredFooter = false ;
227+ mockLandingFooter = true ;
228+ mockChatFormProps . mockClear ( ) ;
229+ } ) ;
230+
231+ test ( 'renders the full footer beneath the welcome screen by default' , ( ) => {
232+ render ( < ChatView /> ) ;
233+
234+ expect ( screen . getByTestId ( 'landing-footer' ) ) . toBeInTheDocument ( ) ;
235+ expect ( screen . queryByTestId ( 'configured-footer' ) ) . not . toBeInTheDocument ( ) ;
236+ expect ( mockChatFormProps ) . toHaveBeenLastCalledWith (
237+ expect . objectContaining ( { footerBelow : true } ) ,
238+ ) ;
239+ } ) ;
240+
241+ test ( 'drops the welcome screen footer when the deployment turns it off' , ( ) => {
242+ mockLandingFooter = false ;
243+
244+ render ( < ChatView /> ) ;
245+
246+ expect ( screen . queryByTestId ( 'landing-footer' ) ) . not . toBeInTheDocument ( ) ;
247+ expect ( screen . queryByTestId ( 'configured-footer' ) ) . not . toBeInTheDocument ( ) ;
248+ expect ( mockChatFormProps ) . toHaveBeenLastCalledWith (
249+ expect . objectContaining ( { footerBelow : false } ) ,
250+ ) ;
251+ } ) ;
252+
253+ test ( 'keeps a configured footer on the welcome screen when the full footer is off' , ( ) => {
254+ mockLandingFooter = false ;
255+ mockConfiguredFooter = true ;
256+
257+ render ( < ChatView /> ) ;
258+
259+ expect ( screen . queryByTestId ( 'landing-footer' ) ) . not . toBeInTheDocument ( ) ;
260+ expect ( screen . getByTestId ( 'configured-footer' ) ) . toBeInTheDocument ( ) ;
261+ expect ( mockChatFormProps ) . toHaveBeenLastCalledWith (
262+ expect . objectContaining ( { footerBelow : true } ) ,
263+ ) ;
264+ } ) ;
265+ } ) ;
0 commit comments