-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The function getStringByteSize() refers to an undefined variable in the minified output. This works around this problem. See babel/minify#430 Add a verify test for WebSocket.send() to make sure the private getStringByteSize() can be called without an error being thrown. Change-Id: I5513e53cc262d13fdc7434601c9557d0814655fc
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const tabris = require('../../build/tabris/'); | ||
const chai = require('chai'); | ||
const expect = chai.expect; | ||
const sinon = require('sinon'); | ||
const sandbox = sinon.sandbox.create(); | ||
const restore = sandbox.restore.bind(sandbox); | ||
const stub = sandbox.stub.bind(sandbox); | ||
const sinonChai = require('sinon-chai'); | ||
|
||
chai.use(sinonChai); | ||
|
||
describe('WebSocket', function() { | ||
|
||
let webSocket; | ||
let client; | ||
|
||
beforeEach(function() { | ||
client = stub({ | ||
call: () => {}, | ||
create: () => {}, | ||
get: () => {}, | ||
listen: () => {} | ||
}); | ||
tabris._init(client); | ||
webSocket = new tabris.WebSocket('ws://url.com', 'chat-protocol'); | ||
}); | ||
|
||
afterEach(restore); | ||
|
||
it('calls send with string data', function() { | ||
tabris._notify(webSocket._proxy.cid, 'open', {}); | ||
|
||
webSocket.send('hello'); | ||
|
||
expect(client.call).to.have.been.calledWith(webSocket._proxy.cid, 'send', {data: 'hello'}); | ||
}); | ||
|
||
}); |