Skip to content

feat: add isClosed observer to TestSseClient#271

Open
kinyoklion wants to merge 1 commit intomainfrom
rlamb/test-sse-client-is-closed
Open

feat: add isClosed observer to TestSseClient#271
kinyoklion wants to merge 1 commit intomainfrom
rlamb/test-sse-client-is-closed

Conversation

@kinyoklion
Copy link
Copy Markdown
Member

@kinyoklion kinyoklion commented May 7, 2026

Adds a one-line, additive bool get isClosed to TestSseClient so test code can assert that the system under test correctly calls close() 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 the launchdarkly_event_source_client package; the FDv2 streaming work that consumes it (PR #267) is feat: for launchdarkly_common_client. Splitting them lets release-please attribute each correctly.

Why test-only is OK on a public API

The TestSseClient class is already documented as test-only:

An SSE client to use for testing.

Changes may be made to this class without following semantic conventions.

The new getter inherits that contract; the docstring on isClosed reiterates 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 TestSseClient API. No production SSE transport logic or data handling is modified.

Overview
Adds a test-only isClosed getter to TestSseClient so unit tests can assert that code under test properly calls close() 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.

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.
@kinyoklion kinyoklion requested a review from a team as a code owner May 7, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant