paladin3895 / google-search

0 stars 0 forks source link

[Chore] Improve brittle tests for the scraper #7

Open olivierobert opened 1 year ago

olivierobert commented 1 year ago

Issue

The current test https://github.com/paladin3895/google-search/blob/master/tests/Feature/GoogleSearchTest.php makes an external request to Google. The risk is that this test could sometimes fail due to network latency and security (rate-limiting from Google) issues, thus giving false negatives. The test is brittle in its current state.

Expected

The tests for SearchEngine should not make a network request. It should remain a unit test, hence having no dependency outside of the class under test.

paladin3895 commented 1 year ago

This is indeed an issue with the unit test. It should use a mock HTTP client to simulate search requests. I will schedule a fix today. Cheers,

paladin3895 commented 1 year ago

Hi Olivier, this issue has been dealt with in this pull request #9