test: remove abbreviations and code smells across package tests#1584
Merged
spydon merged 4 commits intoJul 10, 2026
Conversation
Rename test-local identifiers to full words (response, request, message, error, configuration, connection, and similar), leaving public API names, named arguments, JSON keys and conventional acronyms untouched. Replace weak assertions with proper matchers, remove redundant casts and toString calls, and delete useless or duplicate tests. Convert try/catch throw-assertions and closure-wrapped async expectLater calls to the idiomatic expectLater(future, throwsA(...)) form, and rewrite the stale phone auth tests to assert their real success behavior against the configured stack.
…0-clean-up-package-tests-remove-abbreviations-and-code-smells # Conflicts: # packages/gotrue/test/src/types/user_test.dart # packages/postgrest/test/basic_test.dart # packages/postgrest/test/filter_test.dart # packages/postgrest/test/transforms_test.dart
Convert smoke tests that only awaited an async call to expect(future, completes), and rename them to state the expected outcome.
Tr00d
approved these changes
Jul 10, 2026
Use the closure form for expectLater on Postgrest builders (which implement Future but are not recognized as Future by the linter), keep the bare await for the Postgrest completes smoke tests, and drop the now-unnecessary async from the initialization tests.
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
Cleans up the test suites across every package. No production (
lib/) changes.res/getRes/… →response/result,req→request,params→parameters,msg→message,e/err→error,conn→connection,db→database,at→accessToken,sig→signature,sub→subscription, and similar. Public API names, named arguments, JSON/map keys and conventional acronyms (id, url, jwt, otp, pkce, ws, …) are left untouched.isNotNull,isEmpty,isTrue/isFalse,hasLength,contains,isA<T>(),endsWith,isNot(contains(...)). Redundant.toString()/casts and a pointless cascade removed.try { await op } catch (e) { expect(e, isA<X>()) }and closure-wrappedexpectLater(() => future, throwsA(...))toexpectLater(future, throwsA(...))(69 sites). Genuinely synchronousexpect(() => syncCall(), throwsX)and mockitowhen/verifyclosures were left as-is.try/catchswallowed the non-exception). The test stack deliberately enables phone auth, so they now assert the real success behavior.same()reference-equality tautologies (session,auth_exception,user,user_identity).socket_test"calls callback" (incremented a counter unconditionally, asserted nothing real).Testing
All package suites pass against a local Supabase stack: gotrue 446, realtime 182, postgrest 177, storage 110, functions 45, supabase 83, supabase_common 33, supabase_flutter 63, yet_another_json_isolate 4.
dart analyzeclean,dart formatapplied.Resolves SDK-1290.