Closed
Description
When running jest tests on components which are using the default export of algoliasearch
, algolia appears to try and make requests out to the web to pull down its scripts. This causes a TypeError as the test environment is not supporting this:
FAIL tissues/navigation-header/test.js
● Test suite failed to run
TypeError: Cannot read property 'protocol' of undefined
4 | const apiKey = process.env.NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY;
5 |
> 6 | export default algoliasearch(appId, apiKey);
| ^
7 |
at createStatelessHost (node_modules/@algolia/transporter/dist/transporter.cjs.js:71:27)
at transporter.hosts.hosts.map.host (node_modules/@algolia/transporter/dist/transporter.cjs.js:251:34)
at Array.map (<anonymous>)
at Object.createTransporter (node_modules/@algolia/transporter/dist/transporter.cjs.js:251:22)
at Object.createSearchClient (node_modules/@algolia/client-search/dist/client-search.cjs.js:49:39)
at algoliasearch (node_modules/algoliasearch/dist/algoliasearch.cjs.js:43:25)
at Object.<anonymous> (utils/algolia.js:6:16)
at Object.<anonymous> (tissues/algolia-search/index.js:24:1)
at Object.<anonymous> (tissues/navigation-header/index.js:13:1)
at Object.<anonymous> (tissues/navigation-header/test.js:7:1)
This is currently blocking us from accurately testing algoliasearch components.
Metadata
Metadata
Assignees
Labels
No labels