diff --git a/__tests__/HomeScreen.test.tsx b/__tests__/HomeScreen.test.tsx index 0414d60..d4311ba 100644 --- a/__tests__/HomeScreen.test.tsx +++ b/__tests__/HomeScreen.test.tsx @@ -40,7 +40,7 @@ afterEach(() => { console.error.mockRestore(); }); -describe('AddNoteScreen', () => { +describe('HomeScreen', () => { it('renders without crashing', () => { const routeMock = { params: { untitledNumber: 1 } }; const { getByTestId } = render(); diff --git a/__tests__/MoreScreen.test.tsx b/__tests__/MoreScreen.test.tsx index 2c5b616..b394e87 100644 --- a/__tests__/MoreScreen.test.tsx +++ b/__tests__/MoreScreen.test.tsx @@ -1,15 +1,27 @@ import React from 'react'; -import { render, fireEvent } from '@testing-library/react-native'; +import { render, fireEvent, waitFor } from '@testing-library/react-native'; import { Provider } from 'react-redux'; import configureStore from 'redux-mock-store'; import MorePage from '../lib/screens/MorePage'; import moxios from 'moxios'; import { User } from '../lib/models/user_class'; import { Linking } from 'react-native'; +import { useTheme } from '../lib/components/ThemeProvider'; -// Mock the ThemeProvider +// Create a mock Redux store +const mockStore = configureStore([]); +const store = mockStore({ + navigation: { + navState: 'more', // Add mock navigation state if needed + }, + theme: { + darkMode: false, // Add mock theme state if needed + }, +}); + +// Mock the ThemeProvider with spies jest.mock('../lib/components/ThemeProvider', () => ({ - useTheme: () => ({ + useTheme: jest.fn(() => ({ theme: { primaryColor: '#ffffff', text: '#000000', @@ -17,9 +29,9 @@ jest.mock('../lib/components/ThemeProvider', () => ({ logout: '#ff0000', logoutText: '#ffffff', }, - isDarkmode: false, // Mock initial state for dark mode + isDarkmode: false, // Initial value of isDarkmode toggleDarkmode: jest.fn(), // Mock the toggleDarkmode function - }), + })), })); // Mock the User class @@ -33,17 +45,6 @@ jest.mock('../lib/models/user_class', () => { }; }); -// Create a mock Redux store -const mockStore = configureStore([]); -const store = mockStore({ - navigation: { - navState: 'more', // Add mock navigation state if needed - }, - theme: { - darkMode: false, // Add mock theme state if needed - }, -}); - beforeAll(() => { // Suppress console logs during tests jest.spyOn(console, 'log').mockImplementation(() => {}); @@ -105,4 +106,14 @@ describe('MorePage', () => { "mailto:yashkamal.bhatia@slu.edu?subject=Bug%20Report%20on%20'Where's%20Religion%3F'&body=Please%20provide%20details%20of%20your%20issue%20you%20are%20facing%20here." ); }); + it('renders the "Logout" button', () => { + const { getByText } = render( + + + + ); + + // Check if the "Logout" button is rendered + expect(getByText('Logout')).toBeTruthy(); + }); }); diff --git a/lib/screens/MorePage.tsx b/lib/screens/MorePage.tsx index d351dd2..bcb4091 100644 --- a/lib/screens/MorePage.tsx +++ b/lib/screens/MorePage.tsx @@ -57,10 +57,11 @@ export default function MorePage() { } }; + return ( <> - - Where's Religion + + Where's Religion @@ -72,7 +73,7 @@ export default function MorePage() { - Resources + Resources Linking.openURL( @@ -80,7 +81,7 @@ export default function MorePage() { ) } > - Our Website + Our Website @@ -89,7 +90,7 @@ export default function MorePage() { ) } > - Guide to Ethnography + Guide to Ethnography @@ -98,53 +99,53 @@ export default function MorePage() { ) } > - Guide to Coding + Guide to Coding - Report a Bug + Report a Bug - Meet our Team - Insert Team Photo - Insert Team Message + Meet our Team + Insert Team Photo + Insert Team Message - Frequently Asked Questions + Frequently Asked Questions - What can users do? - + What can users do? + Explore religious traditions, find places of worship, engage in meaningful discussions. - Who is it for? - + Who is it for? + Scholars, students, believers, and the curious about the world's religions. - What's unique? - + What's unique? + Provides a modern method to capture experiences using the devices that are with us every day. - Our Mission - + Our Mission + Connect people of diverse religious backgrounds, beliefs, and practices. - Why use 'Where's Religion?' - + Why use 'Where's Religion?' + Explore religious traditions, find places of worship, engage in meaningful discussions. - - Dark Mode + + Dark Mode - - - Logout - - - + + + + Logout + + + + +