Closed mgmgpyaesonewin closed 3 months ago
The recent update introduces a mock environment for testing the Google search results scraper within the spider-api
project. It adds a new environment variable to toggle between real and mock scraping, incorporates a mock HTML file representing Google search results, and updates the scraper test to use this mock setup conditionally. This change aims to facilitate testing by simulating Google search results without making actual requests to Google's servers.
File Path | Change Summary |
---|---|
spider-api/.env.example |
Added TEST_MOCK_PUPPETEER environment variable with true value |
.../__tests__/puppeteer/mock/fake-google.html |
Added a mock Google search results page |
.../__tests__/puppeteer/scraper.test.js |
Updated to conditionally load a mock page for testing |
🐰✨
In the land of code and wire,
A rabbit hopped, with an idea inspired.
"Let's mock the web, both far and near,
To test our scraper without fear."
With a flick and hop, the code was spun,
"Now testing's easy and much more fun!"
🌟📄🐾
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit