diff options
author | samhed <samuel@cendio.se> | 2016-06-03 14:13:35 +0200 |
---|---|---|
committer | samhed <samuel@cendio.se> | 2016-06-03 16:31:29 +0200 |
commit | b1538a0fa4d9e6e98fdd06eed1a8699d11c8fdc0 (patch) | |
tree | 1460f7cfc58b8b26f4804747e4cf2a4dfb953dcc | |
parent | cf0236de18a3790badd0892ed4de4c2dc95ce91d (diff) | |
download | novnc-b1538a0fa4d9e6e98fdd06eed1a8699d11c8fdc0.tar.gz |
Fix 'sent' assertion
We were completely mishandling the length of the data. Make sure
we look at the length of the websocket rather than the websock object,
and also compare with the expected length.
-rw-r--r-- | tests/assertions.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/assertions.js b/tests/assertions.js index 4bd0cf4..fa122dc 100644 --- a/tests/assertions.js +++ b/tests/assertions.js @@ -37,10 +37,14 @@ chai.use(function (_chai, utils) { }; var data = obj._websocket._get_sent_data(); var same = true; - for (var i = 0; i < obj.length; i++) { - if (data[i] != target_data[i]) { - same = false; - break; + if (data.length != target_data.length) { + same = false; + } else { + for (var i = 0; i < data.length; i++) { + if (data[i] != target_data[i]) { + same = false; + break; + } } } if (!same) { |