-
-
Notifications
You must be signed in to change notification settings - Fork 375
fix: Bump up realtime; add integration tests #1395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
657faf3
to
a4dc846
Compare
Hey, do we have an estimated time when this will be merged? Thanks! |
We're doing some integration testing to ensure we don't break things but hopefully this should get merged in the next couple of weeks |
following 👀 looking forward to using! |
52f2599
to
9fe5d21
Compare
9fe5d21
to
16aaa21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR bumps the realtime dependency version and adds comprehensive integration tests for Supabase functionality. Key changes include:
- Implementation of integration tests covering PostgREST, authentication, and realtime channels.
- Migration scripts for setting up todos tables and realtime RLS policies.
- Updates to helper methods (renaming stripTrailingSlash to cleanUrl) and test commands in package.json and README.
- CI workflow now includes Supabase CLI setup.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
test/integration.test.ts | Added integration tests for multiple Supabase functionalities |
test/helper.test.ts | Updated tests to use the new cleanUrl function |
supabase/seed/seed_todos.sql | Added seed data for the todos table |
supabase/migrations/20250423000000_realtime_rls_setup.sql | Added migration for realtime RLS policies |
supabase/migrations/20250422000000_create_todos_table.sql | Added migration to create todos table |
supabase/.temp/cli-latest | Updated Supabase CLI version in temporary file |
supabase/.branches/_current_branch | Confirmed branch configuration |
src/lib/helpers.ts | Renamed stripTrailingSlash to cleanUrl and updated its functionality |
src/SupabaseClient.ts | Updated to use cleanUrl instead of stripTrailingSlash |
package.json | Modified test commands and bumped realtime-js version |
README.md | Added documentation for running integration tests |
.github/workflows/ci.yml | Added step to set up Supabase CLI in CI |
f1dc0a7
to
e73383f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR bumps the realtime library version and adds integration tests while refactoring URL cleaning logic. The key changes include:
- Adding comprehensive integration tests for Supabase functionalities.
- Replacing the stripTrailingSlash function with a more robust cleanUrl implementation.
- Updating package.json and CI workflow to support integration tests and the new realtime version.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
test/integration.test.ts | Adds integration tests for PostgREST, authentication, and realtime functionality. |
test/helper.test.ts | Updates tests to validate the new cleanUrl behavior for trimming URLs. |
supabase/seed/seed_todos.sql | Adds seed data for the todos table. |
supabase/migrations/*.sql | Introduces new migration scripts for realtime RLS setup and todos table creation. |
supabase/.temp/cli-latest | Updates the Supabase CLI version. |
supabase/.branches/_current_branch | Confirms the current branch. |
src/lib/helpers.ts | Refactors the URL cleaning function from stripTrailingSlash to cleanUrl. |
src/SupabaseClient.ts | Updates usage of the URL cleaning function. |
package.json | Updates realtime-js version and adjusts test scripts for integration testing. |
README.md | Adds documentation for running unit and integration tests. |
.github/workflows/ci.yml | Adds steps to set up the Supabase CLI in the CI workflow. |
@@ -9,8 +9,8 @@ export function uuid() { | |||
}) | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated cleanUrl function now removes both trailing slashes and whitespace. Consider adding a docstring to clarify its enhanced behavior compared to the old stripTrailingSlash implementation.
/** | |
* Cleans a URL by removing trailing slashes and whitespace. | |
* | |
* This function enhances the behavior of the old `stripTrailingSlash` implementation | |
* by also removing any trailing whitespace in addition to slashes. | |
* | |
* @param url - The URL string to clean. | |
* @returns The cleaned URL string without trailing slashes or whitespace. | |
*/ |
Copilot uses AI. Check for mistakes.
|
||
// Wait for subscription | ||
while (!subscribed) { | ||
if (attempts > 50) throw new Error('Timeout waiting for subscription') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The loop uses a magic number (50) for the subscription timeout. Extract this value into a named constant to improve readability and maintainability.
if (attempts > 50) throw new Error('Timeout waiting for subscription') | |
if (attempts > SUBSCRIPTION_TIMEOUT_ATTEMPTS) throw new Error('Timeout waiting for subscription') |
Copilot uses AI. Check for mistakes.
|
||
// Wait on message | ||
while (!receivedMessage) { | ||
if (attempts > 50) throw new Error('Timeout waiting for message') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The message waiting loop also uses the magic number (50) for timeout. Consider refactoring to use a named constant for this timeout threshold for clarity.
if (attempts > 50) throw new Error('Timeout waiting for message') | |
if (attempts > TIMEOUT_THRESHOLD) throw new Error('Timeout waiting for message') |
Copilot uses AI. Check for mistakes.
* fix: Bump up realtime; add integration tests (#1395) * fix: bump up realtime-js (#1409) * fix: bump up realtime-js; await on token change (#1411) * fix: prevent async calls in _listenForAuthEvents (#1412) * fix: bump up realtime-js (#1413) * bump up realtime-js (#1419) * resolve conflict --------- Co-authored-by: Guilherme Souza <[email protected]> Co-authored-by: Guilherme Souza <[email protected]>
What kind of change does this PR introduce?
Bump up realtime; add integration tests