May 2019
Intermediate to advanced
496 pages
10h 38m
English
Let's take a closer look at CustomerSearch. We'll look at the example of entering a search term. This uses a textbox with an onChange handler. Each new character causes a new search to occur, and that should be reflected in the browser's location.
We need to use history.push to programmatically update the API, just as we did in App.
Of interest in this example is that CustomerSearch is actually being full rendered here, because it has a useEffect hook, which many of the tests need to run. But this doesn't affect our tests—we've simply stubbed out SearchButtons so that none of the Link components are rendered:
const renderCustomerSearch = props => renderAndWait( <CustomerSearch {...props} history={{ ...Read now
Unlock full access