Files
iNaturalistReactNative/tests/unit/components/SharedComponents/Map.test.js
Ken-ichi f7dc08a704 Suggestions fixes (#972)
* Bugfix: TaxonDetails was crashing if it received a null taxon
* Send lat and lng instead of latitude and longitude to the score_image
  endpoint
* Show offline suggestions when you are offline
* Show notice when viewing offline suggestions
* Moved code unique to useOnlineSuggestions into that file
* Ensure we use a medium size image to get suggestions when dealing with
  remote URLs
* More logging around React Query retries
* Use default retry logic for useAuthenticatedQuery
* Made a module-resolver shortcut for tests
* Move offline notice above top suggestion; hide when offlines exist but onlines do too
2023-12-15 19:58:12 -08:00

35 lines
1.1 KiB
JavaScript

import { faker } from "@faker-js/faker";
import { screen } from "@testing-library/react-native";
import { Map } from "components/SharedComponents";
import React from "react";
import { renderComponent } from "tests/helpers/render";
describe( "Map", ( ) => {
it( "should be accessible", ( ) => {
expect( <Map /> ).toBeAccessible( );
} );
it( "displays filtered observations on map", async ( ) => {
renderComponent(
<Map
withPressableObsTiles
tileMapParams={{ taxon_id: 47178 }}
/>
);
const tiles = await screen.findByTestId( "Map.UrlTile" );
expect( tiles ).toHaveProp( "urlTemplate", "https://api.inaturalist.org/v2/grid/{z}/{x}/{y}.png?taxon_id=47178&color=%2374ac00&verifiable=true" );
} );
it( "displays location indicator when given an observation lat/lng", async ( ) => {
renderComponent(
<Map
showLocationIndicator
obsLatitude={Number( faker.location.latitude( ) )}
obsLongitude={Number( faker.location.longitude( ) )}
/>
);
const testId = "Map.LocationIndicator";
expect( screen.getByTestId( testId ) ).toBeTruthy();
} );
} );