Skip to content

Commit

Permalink
add disconnect code test
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Nov 9, 2024
1 parent d640965 commit 05b2f0d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ void main() {
expect(true, event.error.toString().contains('Unsupported URL scheme'));
});

test('invalid token - disconnect code received', () async {
final client = centrifuge.createClient(
url,
centrifuge.ClientConfig(token: "invalid"),
);
final disconnectFinish = client.disconnected.first;
client.connect();
final disconnect = await disconnectFinish;
expect(centrifuge.State.disconnected, client.state);
expect(disconnect.code, 3500);
});

test('can connect and disconnect', () async {
final client = centrifuge.createClient(
url,
Expand Down

0 comments on commit 05b2f0d

Please sign in to comment.