Repository navigation
IOTA Watch: testing per-project quotas and row ownership with PGlite #1119
molimao
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I maintain IOTA Watch, an independent, MIT-licensed monitoring dashboard. We use PGlite in our database integration tests, rather than connecting those tests to the production Supabase project.
The fixture starts
new PGlite(), createsanon,authenticatedandservice_roleroles, adds anauth.uid()stand-in, and applies the actual SQL migrations. Test users are synthetic UUIDs. Switching the PostgreSQL role and request claim lets the tests exercise the database functions and ownership checks.Our model has physical device groups plus project bindings. Free and Pro capacity is per project, so a test must check that filling one project does not incorrectly consume another project's quota. The suite also checks preserved legacy records and denies browser-role access to the encrypted connection table.
Database test fixture and cases · SQL migrations
This is a maintainer-submitted example of PGlite for application database tests. The fixture simulates the auth claim; it does not replace live OAuth or hosted-platform acceptance testing.
All reactions