The core library has good test coverage (cookiejar, cookies_txt, nodes, readability, close, article all have tests), but the site extractors have no tests that can run without a live browser:
The existing mockDocument and mockNode in mock_test.go and nodes_test.go provide a pattern for testing without Playwright.
Proposal
For each site extractor, create test cases that:
Use mockDocument with pre-built HTML matching the expected page structure
Test the parsing/extraction logic independently of the browser
Test error handling (missing elements, malformed data)
This would catch regressions when sites change their HTML structure.
**Parent:** #4
## Description
The core library has good test coverage (cookiejar, cookies_txt, nodes, readability, close, article all have tests), but the site extractors have no tests that can run without a live browser:
- `sites/duckduckgo/duckduckgo_test.go` — needs verification (likely requires browser)
- `sites/google/google_test.go` — needs verification
- `sites/powerball/powerball_test.go` — needs verification
- `sites/megamillions/megamillions_test.go` — needs verification
- `sites/wegmans/wegmans_test.go` — needs verification
- `sites/aislegopher/aislegopher_test.go` — needs verification
- `sites/archive/archive_test.go` — needs verification
- `sites/useragents/useragents_test.go` — needs verification
The existing `mockDocument` and `mockNode` in `mock_test.go` and `nodes_test.go` provide a pattern for testing without Playwright.
## Proposal
For each site extractor, create test cases that:
1. Use `mockDocument` with pre-built HTML matching the expected page structure
2. Test the parsing/extraction logic independently of the browser
3. Test error handling (missing elements, malformed data)
This would catch regressions when sites change their HTML structure.
Starting work on this. Plan: create exported extractortest package with MockBrowser, MockDocument, and MockNode that support selector-based responses. Write fixture-based tests for DuckDuckGo and Powerball extractors to establish the pattern.
Starting work on this. Plan: create exported `extractortest` package with `MockBrowser`, `MockDocument`, and `MockNode` that support selector-based responses. Write fixture-based tests for DuckDuckGo and Powerball extractors to establish the pattern.
Work finished — created extractortest package with exported MockBrowser, MockDocument, MockNode supporting selector-based responses. Added extraction tests for DuckDuckGo and Powerball. Merged in PR #43.
Work finished — created `extractortest` package with exported `MockBrowser`, `MockDocument`, `MockNode` supporting selector-based responses. Added extraction tests for DuckDuckGo and Powerball. Merged in PR #43.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Parent: #4
Description
The core library has good test coverage (cookiejar, cookies_txt, nodes, readability, close, article all have tests), but the site extractors have no tests that can run without a live browser:
sites/duckduckgo/duckduckgo_test.go— needs verification (likely requires browser)sites/google/google_test.go— needs verificationsites/powerball/powerball_test.go— needs verificationsites/megamillions/megamillions_test.go— needs verificationsites/wegmans/wegmans_test.go— needs verificationsites/aislegopher/aislegopher_test.go— needs verificationsites/archive/archive_test.go— needs verificationsites/useragents/useragents_test.go— needs verificationThe existing
mockDocumentandmockNodeinmock_test.goandnodes_test.goprovide a pattern for testing without Playwright.Proposal
For each site extractor, create test cases that:
mockDocumentwith pre-built HTML matching the expected page structureThis would catch regressions when sites change their HTML structure.
Starting work on this. Plan: create exported
extractortestpackage withMockBrowser,MockDocument, andMockNodethat support selector-based responses. Write fixture-based tests for DuckDuckGo and Powerball extractors to establish the pattern.Work finished — created
extractortestpackage with exportedMockBrowser,MockDocument,MockNodesupporting selector-based responses. Added extraction tests for DuckDuckGo and Powerball. Merged in PR #43.