Commit c3c3c0c
Alec Gibson
Improve test coverage for
This change improves `SnapshotRequest` test coverage to 100%.
Our current test for checking that a dropped connection works didn't
actually fail properly when removing `this.sent = false` from
`SnapshotRequest._onConnectionStateChanged`, so an improved test has
been written that use middleware to wait until the request has
definitely been sent, before dropping the connection and reconnecting.
It also adds a previously uncovered test case for checking that the
connection cannot send the same request multiple times, by using a
similar setup to the rewritten dropped connection case.
This change also adds some documentation recording why we might want to
reset `this.sent = false`, because just looking at the code it's
unclear why we would ever want to do that.SnapshotRequest.onConnectionStateChanged
1 parent 0249c91 commit c3c3c0c
File tree
2 files changed
+32
-8
lines changed- lib/client
- test/client
2 files changed
+32
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
219 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
220 | 242 | | |
221 | 243 | | |
222 | | - | |
223 | | - | |
| 244 | + | |
224 | 245 | | |
225 | 246 | | |
226 | 247 | | |
| |||
0 commit comments