Files
iNaturalistReactNative/tests/unit/components/SharedComponents/ProjectList/ProjectListContainer.test.js
Corey Farwell a43446909c Remove the need to specify TypeScript file extensions in imports (#3094)
* Don't require TS extensions in imports

* Resolve all import extension errors

* Remove file extension from import paths used in mocks

* Remove .d of type definition file paths

* Remove .d of type definition file and import as type

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-09-07 23:41:42 +02:00

33 lines
960 B
JavaScript

import { useRoute } from "@react-navigation/native";
import { render, screen } from "@testing-library/react-native";
import ProjectListContainer from "components/ProjectList/ProjectListContainer";
import React from "react";
import factory from "tests/factory";
const mockProjects = [
factory( "RemoteProject", {
title: "project_1"
} ),
factory( "RemoteProject", {
title: "project_2"
} )
];
describe( "ProjectList", () => {
beforeAll( ( ) => {
useRoute.mockImplementation( ( ) => ( {
params: {
projects: mockProjects
}
} ) );
} );
it( "should display a list with all project titles", async () => {
render( <ProjectListContainer /> );
const firstProjectTitle = await screen.findByText( mockProjects[0].title );
expect( firstProjectTitle ).toBeVisible( );
const secondProjectTitle = await screen.findByText( mockProjects[1].title );
expect( secondProjectTitle ).toBeVisible( );
} );
} );