import {dirname, resolve} from 'path' import React from 'react'; import { act, fireEvent, render, screen } from '@testing-library/react-native'; import { createStackNavigator } from '@react-navigation/stack'; jest.mock("@/app/i18n/api", () => require("../../__mocks__/api.ts")); import TTNavStack from '../TTNavStack'; const Stack = createStackNavigator(); describe('Navigation', () => { beforeEach(() => { // Reset the navigation state before each test jest.clearAllMocks(); }); it('Navigates to ConversationThread on language selection', async () => { render(); const languageSelectionText = await screen.findByText(/I Speak French\./i); act(() => { fireEvent.press(languageSelectionText); }) expect(await screen.findByText("Conversation Thread")).toBeOnTheScreen(); }); it('Navigates to Settings on settings selection', async () => { render(); const settingsButton = await screen.findByText("Settings"); act(() => { fireEvent.press(settingsButton) }) expect(await screen.findByText("Settings")).toBeOnTheScreen(); }); });