30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
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';
|
|
|
|
jest.mock('expo-file-system', () => require('./__mocks__/expo-file-system'));
|
|
|
|
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();
|
|
});
|
|
}); |