test: raise Vitest coverage above 75% for worker, allowlist, and imports - #289
Open
Doom-pixel wants to merge 1 commit into
Open
Doom-pixel wants to merge 1 commit into
Doom-pixel wants to merge 1 commit into
Conversation
Raise production coverage above the 75% goal with behavior-focused suites for the worker fetch handler, SQL allowlist, CSV import, HTTP routes, Durable Object RPC, and SDK/hyperdrive query paths. Also fix RLS so schema-qualified policies match unqualified tables and nested FROM subqueries, and copy JWT claims onto the request data source context after authentication.
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.
Summary
Improves Vitest coverage for outerbase/starbasedb#71 with behavior-focused tests rather than line-count padding. The suite exercises real, fake, omitted, and invalid inputs on paths previously at 0%.
Also includes two small production fixes found while writing the tests:
public.usersapply to unqualified SQL tables likeuserswithout leaking across schemas; nestedFROM (SELECT …)subqueries are traversed.dataSource.contextso plugins and RLS can readsubafter authentication.Coverage config excludes
src/**/*.test.tsso Istanbul measures production code instead of test files.Coverage summary
Measured with
pnpm vitest run --coverage.enabled trueon productionsrc/**/*.ts(test files excluded):All four thresholds are above the 75% goal. 23 test files and 254 tests passed. New/expanded suites cover the worker, allowlist, CSV/JSON imports, auth/source selection, Durable Object RPC, LiteREST, RLS, and HTTP routes.
Demo / verification notes
Run
pnpm testorpnpm vitest run; the new files execute through the existing GitHub Action command. Production coverage can be reproduced withpnpm vitest run --coverage.enabled true.Remaining gaps:
plugins/**is outside the coverage include; LiteREST andsrc/plugin.tsretain a few uncovered branches;/status/tracestill uses the live Cloudflare trace URL.Bounty
Algora bounty: outerbase/starbasedb#71
/claim #71