Define stable crawler test layers and fixtures
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 103
- Forks
- 18
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 555
Description
Problem
The crawler has useful parser, transport, lifecycle, database, queue, and live-model coverage, but there is no short test contract explaining which boundary owns which behavior. Some large tests cross several concerns, and future rule/runtime improvements could force broad fixture and assertion rewrites.
The goal is stable mocks plus representative integration tests, not more tests at every layer.
Relevant code:
apps/server/src/scraper/**/*.test.tsapps/server/src/orpc/routes/external-sites/scrape-sources/**/*.test.tsdocs/development/backend-testing.md- #220
Desired outcome
Tests follow stable product/runtime seams so internal refactors do not require rewriting the suite.
Acceptance criteria
- Document the crawler test layers: pure parser fixtures; mocked HTTP/clock/model boundaries; database-backed lifecycle/service/sink integration; queue wiring smoke tests; live model evals in
pnpm evals. - Keep behavior assertions at public boundaries and avoid asserting internal call order unless order is the behavior.
- Add or extract only the small crawler builders/harnesses already justified by repetition, reusing the factory direction in #220.
- Keep historical rule fixtures owned by their version compatibility tests; current parser tests use only the current contract.
- Ensure review, price, and catalog each have one representative database-backed run from persisted configuration through the real sink, with remote HTTP mocked.
- Verify that changing a parser helper or run-plan implementation does not require updating route-level fixtures.
Non-goals
- Rewrite all existing crawler tests.
- Mock database transactions in tests whose purpose is persistence, ownership, or concurrency.
- Put live model behavior in deterministic
pnpm test.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the crawler tests under apps/server/src/scraper//*.test.ts and apps/server/src/orpc/routes/external-sites/scrape-sources//*.test.ts, then read docs/development/backend-testing.md and the factory direction in #220. Map existing tests to the requested layers, keeping current-contract parser fixtures separate from historical rule fixtures. Done means the layer contract is documented and review, price, and catalog each have a representative database-backed run with mocked HTTP, while pnpm test remains deterministic and live model evals stay in pnpm evals.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, testing-qa
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100