Repository navigation
Add e2e + D1 integration tests, CI, and fix two bugs they found - #1
Merged
Merged
Conversation
- tests/e2e: sign-in redirect, signed-in session, groups/expenses/settle-up, stranger blocked, recurring expense, run against the built Worker in parallel - src/tests/integration: authorization, balances, expense atomicity, settlements, recurrence idempotency, D1 query regressions (vitest + @cloudflare/vitest-plugin) - .github/workflows/ci.yml: typecheck, integration, e2e in parallel with caching - replace Jest with Vitest; scenarios adapted from upstream PR oss-apps#738 Bugs found by the tests and fixed here: - any signed-in user could read, edit or delete any expense by id, and write to any group - runRecurringJob used db.run() inside a D1 batch, so recurring expenses never ran
|
I admit that I am not an expert in testing webapps beyond jest and just let my agent set up the harness. If there are some comments or suggestions you might have to my solution, I would be glad to hear them and bring upstream :) |
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.
What
wrangler dev, throwaway local D1), 4 parallel workers: sign-in redirect, signed-in session, group + expense + settle up, stranger blocked, recurring expense.@cloudflare/vitest-plugin) on a real local D1 with the production migrations: authorization, balances/simplification, expense create/edit/delete atomicity, settlements, recurrence (incl. idempotent retries), D1 query regressions..github/workflows/ci.yml): typecheck, integration and e2e as three parallel jobs; pnpm store, Playwright browsers and the build are cached. Target: under 2 minutes.Bugs the tests found (fixed here, not deployed yet)
validateEditExpensePermissionwas effectively a no-op,getExpenseDetailshad no check) and write expenses or currency conversions into any group. AddedcanAccessExpenseandassertCanWriteToGroup.runRecurringJobused drizzledb.run()inside a D1 batch, which throws. Rewritten with prepared D1 statements.Local results
tsc --noEmit: cleanNot covered
Bank sync, Splitwise import, web-push, UI flows beyond sign-in and page loads (setup goes through tRPC).