mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-14 03:54:14 +00:00
Set up new module structure
This commit is contained in:
parent
5f5178d2e8
commit
2e864f5293
534 changed files with 235854 additions and 1 deletions
43
node_modules/socket.io/support/node-websocket-client/test/test-readonly-attrs.js
generated
vendored
Normal file
43
node_modules/socket.io/support/node-websocket-client/test/test-readonly-attrs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// Verify that some attributes of a WebSocket object are read-only.
|
||||
|
||||
var assert = require('assert');
|
||||
var sys = require('sys');
|
||||
var WebSocket = require('../lib/websocket').WebSocket;
|
||||
var WebSocketServer = require('websocket-server/ws/server').Server;
|
||||
|
||||
var PORT = 1024 + Math.floor(Math.random() * 4096);
|
||||
|
||||
var wss = new WebSocketServer();
|
||||
wss.listen(PORT, 'localhost');
|
||||
wss.on('connection', function(c) {
|
||||
c.close();
|
||||
wss.close();
|
||||
});
|
||||
var ws = new WebSocket('ws://localhost:' + PORT + '/', 'biff');
|
||||
ws.on('open', function() {
|
||||
assert.equal(ws.CONNECTING, 0);
|
||||
try {
|
||||
ws.CONNECTING = 13;
|
||||
assert.equal(
|
||||
ws.CONNECTING, 0,
|
||||
'Should not have been able to set read-only CONNECTING attribute'
|
||||
);
|
||||
} catch (e) {
|
||||
assert.equal(e.type, 'no_setter_in_callback');
|
||||
}
|
||||
|
||||
assert.equal(ws.OPEN, 1);
|
||||
assert.equal(ws.CLOSING, 2);
|
||||
assert.equal(ws.CLOSED, 3);
|
||||
|
||||
assert.equal(ws.url, 'ws://localhost:' + PORT + '/');
|
||||
try {
|
||||
ws.url = 'foobar';
|
||||
assert.equal(
|
||||
ws.url, 'ws://localhost:' + PORT + '/',
|
||||
'Should not have been able to set read-only url attribute'
|
||||
);
|
||||
} catch (e) {
|
||||
assert.equal(e.type, 'no_setter_in_callback');
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue