test: expand unit coverage for supabase_common and storage_client types#1595
Merged
Conversation
Bring supabase_common to full line coverage by testing FetchOptions defaults, the dart:io platform getters, the remaining ReplaySubject branches (async error replay, sync value replay, setter-assigned hooks) and the retry onRetry callback. Add a storage_client types_test covering fromJson parsing, query/map serializers, SignedUrl equality and copyWith, exhaustive matching over the sealed SignedUrlResult, StorageException, TransformOptions, DownloadBehavior and StorageRetryController.
QuintinWillison
approved these changes
Jul 15, 2026
QuintinWillison
left a comment
Member
There was a problem hiding this comment.
Any PR that straight up adds more tests pretty much always gets my instant approval! 💪
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
Fills genuine, server-free unit coverage gaps found by measuring actual line coverage (
dart test --coverage+format_coverage) across the self-contained packages.supabase_common→ now 100% line coverage on every filetest/supabase_common_test.dart:FetchOptionsgroup (defaults + provided values, previously 0%).platform infogroup covering thedart:iogetters (platform_io.dart, previously 0%).ReplaySubjectcases: async error replay, sync value replay, setter-assignedonListen/onCancel, and theonPause/onResumeno-ops.test/retry_test.dart: covers theonRetrycallback (the one uncovered line inretry.dart).storage_client/lib/src/types.dart→ 86.8% to ~99%New
test/types_test.dart(29 tests):Bucket/FileObject/FileObjectV2/PaginatedListResultfromJson(including theFormatExceptionpath and defaults), thetoMap/toQueryParametersserializers,SignedUrlequality/hashCode/copyWith/toString, exhaustiveswitchmatching over the sealedSignedUrlResult,StorageException,TransformOptions.toQueryParams,DownloadBehaviorandStorageRetryController.All new and modified tests pass and are formatted. No production code changed.
Issues surfaced while writing these tests
storage_client/lib/src/fetch.dart—_handleError'selsebranch (handling a non-http.Responseerror) is unreachable; both call sites only ever pass anhttp.Response. Left as-is here; flagging for follow-up.ReplaySubjectsync-replay quirk — async: truesubject delivers live events synchronously but replays the latest buffered event to a late subscriber asynchronously (becauseStream.multischedules its generator). Tests await accordingly.storage_client/test/client_test.dartand 62 postgrest "Default http client" tests require a running/clean local server; the additions here are all offline/mock-based.