Update test references

This commit is contained in:
Ryan Castner 2020-04-06 17:38:33 -04:00
parent 2a2c269ebb
commit 5e72400c5a
3 changed files with 170 additions and 171 deletions

View File

@ -29,12 +29,12 @@ chai.use(function (_chai, utils) {
_chai.Assertion.addMethod('sent', function (target_data) { _chai.Assertion.addMethod('sent', function (target_data) {
const obj = this._obj; const obj = this._obj;
obj.inspect = () => { obj.inspect = () => {
const res = { _webChannel: obj._webChannel, rQi: obj._rQi, _rQ: new Uint8Array(obj._rQ.buffer, 0, obj._rQlen), const res = { _rawChannel: obj._rawChannel, rQi: obj._rQi, _rQ: new Uint8Array(obj._rQ.buffer, 0, obj._rQlen),
_sQ: new Uint8Array(obj._sQ.buffer, 0, obj._sQlen) }; _sQ: new Uint8Array(obj._sQ.buffer, 0, obj._sQlen) };
res.prototype = obj; res.prototype = obj;
return res; return res;
}; };
const data = obj._webChannel._get_sent_data(); const data = obj._rawChannel._get_sent_data();
let same = true; let same = true;
if (data.length != target_data.length) { if (data.length != target_data.length) {
same = false; same = false;

File diff suppressed because it is too large Load Diff

View File

@ -194,7 +194,6 @@ describe('WebChannel', function () {
}); });
it('should actually send on the websocket', function () { it('should actually send on the websocket', function () {
sock._channelStates = sock._getChannelStates("WebSocket");
sock._rawChannel.bufferedAmount = 8; sock._rawChannel.bufferedAmount = 8;
sock._rawChannel.readyState = WebSocket.OPEN; sock._rawChannel.readyState = WebSocket.OPEN;
sock._sQ = new Uint8Array([1, 2, 3]); sock._sQ = new Uint8Array([1, 2, 3]);
@ -270,7 +269,7 @@ describe('WebChannel', function () {
}); });
it('should open the actual websocket', function () { it('should open the actual websocket', function () {
sock.open({ uri: 'ws://localhost:8675', protocols: 'binary' }); sock.open('ws://localhost:8675', 'binary');
expect(WebSocket).to.have.been.calledWith('ws://localhost:8675', 'binary'); expect(WebSocket).to.have.been.calledWith('ws://localhost:8675', 'binary');
}); });
@ -279,7 +278,7 @@ describe('WebChannel', function () {
describe('closing', function () { describe('closing', function () {
beforeEach(function () { beforeEach(function () {
sock.open({ uri: 'ws://' }); sock.open('ws://');
sock._rawChannel.close = sinon.spy(); sock._rawChannel.close = sinon.spy();
}); });
@ -325,7 +324,7 @@ describe('WebChannel', function () {
sock.on('open', sinon.spy()); sock.on('open', sinon.spy());
sock.on('close', sinon.spy()); sock.on('close', sinon.spy());
sock.on('error', sinon.spy()); sock.on('error', sinon.spy());
sock.open({ uri: 'ws://' }); sock.open('ws://');
}); });
it('should call _recv_message on a message', function () { it('should call _recv_message on a message', function () {
@ -444,7 +443,7 @@ describe('WebChannel', function () {
let sock; let sock;
beforeEach(function () { beforeEach(function () {
sock = new WebChannel(); sock = new WebChannel();
sock.open({ uri: 'ws://', protocols: 'binary' }); sock.open('ws://', 'binary');
sock._rawChannel._open(); sock._rawChannel._open();
}); });