test(cloud-function): cover proxyBSA request handling - #513
Draft
caugner wants to merge 1 commit into
Draft
Conversation
Exercise the BSA handler end-to-end through the real router: method checks, `/pong/get` validation and `plusAvailable`, `/pong/click` referer and signature checks, and `/pimg/` signature verification plus image proxying (headers, content-type allowlist, upstream errors). The dummy bucket doubles as the image host, so no request leaves the machine. Cases that would call BuySellAds are intentionally left out.
caugner
added this pull request to stack #515
September 9, 2026 10:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
cloud-function/src/handlers/proxy-bsa.test.js, exercising the BSA handler end-to-end through the real router:/pong/paths./pong/get: body validation andplusAvailablederived from the viewer country./pong/click: referer and code signature checks./pimg/: signature verification, image proxying with hardened headers, content-type allowlist (refuses SVG), uncached upstream errors.Motivation
Make it safer to auto-merge Dependabot bumps by covering
proxy-bsa.js, which was the least-tested request handler (22% line coverage). Its ad and image proxying runs on every page view.Additional details
The dummy bucket from
proxy-helpers.jsdoubles as the image host, so no request leaves the machine. Cases that would call BuySellAds (/pong/getwith valid zones, signed/pong/clickand/pong/viewed) are intentionally left out.Line coverage:
proxy-bsa.js22% -> 92%,internal/pong/image.js38% -> 92%,internal/pong/coding.js57% -> 96%.Related issues and pull requests