supabase-database-testing

Automate Supabase PostgreSQL database testing with pgTAP.

Updated Aug 29, 2023
One-click install
npx skills add https://github.com/SaschaLeh/dotfiles --skill supabase-database-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-database-testing
Source: https://github.com/SaschaLeh/dotfiles/tree/main/dot_claude/skills/supabase-database-testing
Command: npx skills add https://github.com/SaschaLeh/dotfiles --skill supabase-database-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing Supabase PostgreSQL databases with pgTAP is essential to ensure correctness of database logic, enforce access rules, and maintain data integrity across migrations and deployments.

Core Features & Use Cases

  • pgTAP-based unit tests for functions, tables, and access policies within a Supabase project.
  • RLS policy verification, deterministic test data setup, and simulated authenticated users.
  • Organized test files under supabase/tests with a standard setup/rollback pattern to keep databases clean and reproducible.

Quick Start

Run the database test suite with supabase test db to execute all tests located under supabase/tests.

Frequently Asked Questions about supabase-database-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate pgTAP database tests for Supabase PostgreSQL?

You can automate pgTAP database tests for Supabase PostgreSQL by organizing test files under supabase/tests and running the test suite using the supabase test db command to execute all tests with deterministic plan and finish patterns.

How do I unit test RLS policies in a Supabase database?

Unit testing RLS policies in a Supabase database involves using pgTAP to verify access rules, simulate authenticated users, and set up deterministic test data to ensure your Row Level Security policies enforce correct data access restrictions.

Do I need a migrations-based setup to run Supabase database tests?

Yes, a migrations-based setup is required to run Supabase database tests. The testing workflow relies on this structure to apply database schema changes and maintain a clean, reproducible environment using a standard setup and rollback pattern.

What is the best way to organize pgTAP test files in a PostgreSQL project?

The best way to organize pgTAP test files in a PostgreSQL project is to place them under the supabase/tests directory, ensuring they follow a standard setup and rollback pattern to keep the database clean and reproducible.

Can I test database triggers and functions using pgTAP in Supabase?

Yes, you can test database triggers and functions using pgTAP in Supabase. The testing workflow applies to unit testing functions, triggers, and tables to ensure correctness of database logic across migrations and deployments.