Files
madbase/.trae/documents/plan_20260311_202527.md

26 lines
1.5 KiB
Markdown

I will implement extensive integration tests for Storage and Authentication, and add a placeholder for Edge Functions (as they are not yet implemented in the core).
### 1. Database Setup Update
I will update `tests/integration/setup_db.sql` to create specific buckets for testing:
- `public-bucket`: Publicly accessible.
- `private-bucket`: Private (requires authentication).
### 2. Authentication Tests (`auth.test.ts`)
I will expand the authentication tests to cover:
- **Session Persistence**: Verify `getUser()` returns the logged-in user.
- **Token Refresh**: Verify `refreshSession()` issues a new token.
- **Error Handling**: Verify robust handling of invalid credentials.
### 3. Storage Tests (`storage.test.ts`)
I will expand storage tests to verify Row Level Security (RLS) and permissions:
- **Public Access**: Verify `anon` users can download from `public-bucket`.
- **Private Access**: Verify `anon` users **cannot** download from `private-bucket`.
- **Upload Permissions**: Verify `authenticated` users can upload to `private-bucket`.
- **Deletion**: Verify `authenticated` users can delete their own files (if delete is implemented, otherwise note it).
### 4. Edge Functions Tests (`functions.test.ts`)
I will create a new test file `tests/integration/functions.test.ts` that:
- Marks the test suite as `skipped`.
- Explains that Edge Functions are specified but not yet implemented in the current codebase.
This ensures we have a comprehensive regression suite for the implemented features while tracking future requirements.