You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebtritSignalingClient.defaultExecuteTransactionTimeoutDuration // 10 s
95
+
```
96
+
81
97
## Test Patterns
82
98
99
+
### Unit tests
100
+
83
101
- JSON fixtures in `test/src/events/event_jsons.dart` and `error_event_jsons.dart`.
84
102
-`MockWebSocketChannel` + `MockWebSocketSink` via `mocktail`; `StreamController` injects server messages.
85
103
-`fake_async` for deterministic keepalive/timeout tests.
86
104
-`FakeWebtritSignalingClient` in `test/src/factories/` for higher-level tests.
87
105
106
+
### Live tests (`test/live_call_test.dart`, tag `live`)
107
+
108
+
Two-client strategy — `clientA` (caller) and `clientB` (callee) connect to a real server.
109
+
Callee answers programmatically via `AcceptRequest` (no auto-answer on the test server).
110
+
111
+
Key patterns:
112
+
113
+
- Pre-register all `awaitEvent<T>()` futures **before** sending any request to avoid missing events on a broadcast stream.
114
+
- Fetch fresh session tokens in each `setUp` — WebTrit tokens are invalidated when the WebSocket session closes.
115
+
- Use `force=false` in `connect()` — `tearDown` disconnects cleanly so no stale sessions exist.
116
+
-`_LiveClient.awaitEvent<T>` wraps the broadcast stream with a `Completer`; fails immediately on `CallErrorEvent / LineErrorEvent / SessionErrorEvent`.
117
+
- Cleanup after tests where server behaviour is non-deterministic (multi-endpoint SIP accounts) uses `try/catch` around `HangupRequest` instead of awaiting `HangupEvent`.
118
+
88
119
## Commands
89
120
90
121
```bash
@@ -93,6 +124,14 @@ dart test test/webtrit_signaling_test.dart
93
124
dart test --name "buildTenantUrl"
94
125
dart analyze
95
126
dart format .
127
+
128
+
# Live integration tests (requires real server credentials)
0 commit comments