β π€ add grapher config endpoint e2e tests with local R2 - #6196
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Quick links (staging server):
Login:
Archive:SVG tester:Number of differences (graphers): 0 β
Edited: 2026-03-06 08:24:32 UTC |
ikesau
left a comment
There was a problem hiding this comment.
lgtm! just a few suggestions
read through the code then ran each test with logging enabled and changed things to make sure the tests failed in the expected ways.
| return context as unknown as Parameters<typeof grapherOnRequest>[0] | ||
| } | ||
|
|
||
| function makeMultiDimContext(request: Request, env: Env, slug: string) { |
There was a problem hiding this comment.
There are no tests using the multi-dim path, so this code is redundant?
| } | ||
|
|
||
| function makeGrapherContext(request: Request, env: Env) { | ||
| const envWithAssets = env.ASSETS |
There was a problem hiding this comment.
If I understand correctly, unstable_startWorker doesn't inject ASSETS so I'm not sure what the point of this ternary is.
| expect(second.status).toBe(304) | ||
| }) | ||
|
|
||
| it("falls back to fallback R2 bucket when primary misses", async () => { |
There was a problem hiding this comment.
This one feels like it's testing seedR2 as much as it's testing our worker logic.
It's probably fine, but you could maybe also assert that the primary bucket is empty too.
- add a worker-runtime e2e test suite for /grapher/:slug.config.json - seed local Miniflare R2 buckets with a real life-expectancy config fixture - cover primary bucket fetch, ETag 304, fallback bucket, 404, and nocache behavior - use a dedicated wrangler e2e config with local-only R2 bindings (no remote: true)
- simplify test worker context by always injecting a test ASSETS stub - add a test-only r2-has-key endpoint for assertions - strengthen fallback test to assert key is absent in primary and present in fallback before fetch
971882e to
2c4a241
Compare

Context
This PR adds end-to-end testing infrastructure for the grapher config R2 functionality using Wrangler's local development capabilities.
Testing guidance
Run the new e2e tests to verify R2 bucket functionality:
The tests verify: