j40-cejst-2/client/src/components/MapSearchMessage/MapSearchMessage.test.tsx
Vim 8e31ca032c
[Draft] Adds Nominatum search behind a feature flag (#935)
* Add intial search component

* Add nominatum simple

* Connect search field to Nominatum API

- remove react-query
- remove react-query logic from J40Map
- move searchHandler to MapSearch

* Adjust zoom and territory focus

- adjust zoom buttons in CSS to allow for search field

* Place search behind a feature flag

* Add cors to fetch and error handling

- this is to test on OMB machines

* Add error messaging and bound search results to US

- adjust controls to add error message to search
- add MapSearchMessage component for error message
- add unit tests
- add state to track if API results are empty
- add intl on two strings, placeholder and error message

* Remove warpper around MapSearch component

- reorder component import in J40Map
- remove unused CSS in MapSearch.module.scss
- remove and comment on wrapper error on MapSearch
- rename isSearchEmpty to isSearchResultsEmpty
- update snapshot

* Add error message

- if the search query returns null, show an error message
2021-12-03 07:56:15 -08:00

28 lines
844 B
TypeScript

import * as React from 'react';
import {render} from '@testing-library/react';
import {LocalizedComponent} from '../../test/testHelpers';
import MapSearchMessage from './MapSearchMessage';
describe('rendering of the MapSearchMessage when search results are empty', () => {
const {asFragment} = render(
<LocalizedComponent>
<MapSearchMessage isSearchEmpty={true}/>
</LocalizedComponent>,
);
it('checks if component renders', () => {
expect(asFragment()).toMatchSnapshot();
});
});
describe('rendering of the MapSearchMessage when search results are not empty', () => {
const {asFragment} = render(
<LocalizedComponent>
<MapSearchMessage isSearchEmpty={false}/>
</LocalizedComponent>,
);
it('checks if component renders', () => {
expect(asFragment()).toMatchSnapshot();
});
});