Almost all of our tests rely on sites continuing to exist and remain mostly unchanged (stay compatible) with current implementations. Unit tests should instead be in a few tiers:
- Basic functionality tests that verify invariants of the codebase, which should not rely on live site input data.
- Unit tests of ripper functionality against a known version of the page. This might or might not require launching a web server with static pages encoded in it, sufficient for the test. At minimum it requires HTML of entire pages to be encoded in the test suite either as files or static strings.
- Tests that the current versions of sites meet the schema that we expect to parse. No downloads, just request a page and check that it has a valid structure we're testing against.
- What we have today: fetch pages from real sites and test downloading the contents, which causes us to get rate limited and makes most tests flaky when ran frequently by CI and users developing the app. Especially if we actually do the downloads. It should be enough to check that a resource exists without actually downloading it.
Almost all of our tests rely on sites continuing to exist and remain mostly unchanged (stay compatible) with current implementations. Unit tests should instead be in a few tiers: