feat: add isClosed observer to TestSseClient#271
Open
kinyoklion wants to merge 1 commit intomainfrom
Open
Conversation
Lets test code assert that the SUT correctly tears the SSE connection down. Test-only addition; the production SSEClient implementations do not expose this state, and the TestSseClient class is already documented as test-only with no semver guarantee.
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.
Adds a one-line, additive
bool get isClosedtoTestSseClientso test code can assert that the system under test correctly callsclose()on its SSE client.```dart
/// Whether [close] has been called on this client. Test-only --
/// production [SSEClient] implementations do not expose this state,
/// and tests asserting against it are inherently white-box. Use to
/// verify that code under test correctly tears the connection down.
bool get isClosed => _messageEventsController.isClosed;
```
Why this is its own PR
Cleaner changelog: this is a
feat:for thelaunchdarkly_event_source_clientpackage; the FDv2 streaming work that consumes it (PR #267) isfeat:forlaunchdarkly_common_client. Splitting them lets release-please attribute each correctly.Why test-only is OK on a public API
The
TestSseClientclass is already documented as test-only:The new getter inherits that contract; the docstring on
isClosedreiterates it explicitly so a reader of the getter alone has the context.Verification
dart format,dart analyze lib test, and the full event_source_client test suite (46 tests) all pass.Note
Low Risk
Low risk additive change limited to the test-only
TestSseClientAPI. No production SSE transport logic or data handling is modified.Overview
Adds a test-only
isClosedgetter toTestSseClientso unit tests can assert that code under test properly callsclose()and tears down the SSE stream.Reviewed by Cursor Bugbot for commit 3475ea5. Bugbot is set up for automated code reviews on this repo. Configure here.