2025-02-19 06:13:10 -08:00

37 lines
1.2 KiB
TypeScript

import {dirname, resolve} from 'path'
import React from 'react';
import { fireEvent, render, screen } from '@testing-library/react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import TTNavStack from '../TTNavStack';
// Mock the expo-file-system/next module
jest.mock('expo-file-system/next', () => ({
File: jest.fn(),
Paths: {
join: jest.fn(),
},
}));
const Stack = createStackNavigator();
describe('Navigation', () => {
beforeEach(() => {
// Reset the navigation state before each test
jest.clearAllMocks();
});
it('Navigates to ConversationThread on language selection', async () => {
render(<TTNavStack />);
const languageSelectionText = await screen.findByText("Language Selection");
fireEvent.press(languageSelectionText);
expect(await screen.findByText("Conversation Thread")).toBeOnTheScreen();
});
it('Navigates to Settings on settings selection', async () => {
render(<TTNavStack />);
const settingsButton = await screen.findByText("Settings");
fireEvent.press(settingsButton);
expect(await screen.findByText("Settings")).toBeOnTheScreen();
});
});