Mock Bible AI API and scraping calls in tests#176
Conversation
Streamlined test execution by: - Mocking `GetPassageHTML` in `pkg/app/passage_test.go` and `pkg/app/devo_test.go` to prevent external network calls to BibleGateway during unit tests. - Updating `pkg/app/api_client_test.go` to conditionally run integration tests against the real Bible AI API only if `BIBLE_API_URL` is explicitly set and not equal to "https://example.com". Otherwise, it defaults to a safe mock environment. - Adding a `Fallback: Scrape` test case in `passage_test.go` to verify the fallback logic without triggering actual network requests. These changes ensure that standard "MR tests" are fast and isolated, while still allowing a "comprehensive eval" against the real API via environment configuration.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
- Created `docs/TESTING.md` to outline the hybrid testing strategy (standard mocks vs. conditional live integration). - Refactored `pkg/app/passage_test.go` and `pkg/app/devo_test.go` to mock `GetPassageHTML`, preventing external scraping during unit tests. - Updated `pkg/app/api_client_test.go` to support conditional live API testing when `BIBLE_API_URL` is configured. - Cleaned up test logic to ensure proper isolation of global variable mocks.
Implemented mocking for
GetPassageHTMLto avoid external scraping in unit tests and updatedapi_client_test.goto support conditional real API integration tests based on environment variables. This reduces unnecessary external API calls while maintaining the ability to verify against the real system when configured.PR created automatically by Jules for task 17903795904113914198 started by @julwrites