Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
442ba7f
squash commit from ws
eljefedelrodeodeljefe Jan 17, 2016
c955812
ws: Do not run tests through make
eljefedelrodeodeljefe Jan 13, 2016
38c27f1
removes cpp deps
eljefedelrodeodeljefe Jan 13, 2016
fc8d1c0
deprecates make
eljefedelrodeodeljefe Jan 14, 2016
0951c85
have ultron included in websocket class file
eljefedelrodeodeljefe Jan 14, 2016
6ffce4a
deprecates ultron as external dep
eljefedelrodeodeljefe Jan 14, 2016
60205f9
Now native options parsing; fails one test TODO
eljefedelrodeodeljefe Jan 15, 2016
3fe34bc
style changes in WebSocketServer
eljefedelrodeodeljefe Jan 15, 2016
48098fa
removes Options as dep; style changes
eljefedelrodeodeljefe Jan 16, 2016
ad3bec9
add prototypical inheritance. prep for including definition
eljefedelrodeodeljefe Jan 16, 2016
1a45444
BufferUtil: refactor for style and prototypical inhertiance
eljefedelrodeodeljefe Jan 16, 2016
031bc3e
style: finish const-require in files
eljefedelrodeodeljefe Jan 16, 2016
26b5029
Receiver, Opcode handlers: refactor for more expressiveness
eljefedelrodeodeljefe Jan 16, 2016
743d3d8
extract opcodes into separate file -> prepping it as class
eljefedelrodeodeljefe Jan 16, 2016
e7563d6
opcodes: change for style
eljefedelrodeodeljefe Jan 16, 2016
f62fb0f
wording: callback -> cb
eljefedelrodeodeljefe Jan 16, 2016
9888a33
remove Validation as dep
eljefedelrodeodeljefe Jan 17, 2016
d968ccf
minor style and formatting in lib/
eljefedelrodeodeljefe Jan 17, 2016
e740602
refactor for node-core test structure
eljefedelrodeodeljefe Jan 18, 2016
30370b3
tests: ports to node-core compliant structure; no 'should'
eljefedelrodeodeljefe Jan 20, 2016
84575af
editing file structure to be core compatible
eljefedelrodeodeljefe Jan 21, 2016
794062a
changes file structure for node comppat, no external dep
eljefedelrodeodeljefe Jan 21, 2016
3bae80a
remove app files
eljefedelrodeodeljefe Jan 21, 2016
d175dec
remove examples from app repo
eljefedelrodeodeljefe Jan 21, 2016
96582c2
ports websockets docs. git mv
eljefedelrodeodeljefe Jan 21, 2016
5c9af45
ports benchmarks
eljefedelrodeodeljefe Jan 21, 2016
f954efa
remove integration tests
eljefedelrodeodeljefe Jan 21, 2016
56834d7
removes unnecessary module files
eljefedelrodeodeljefe Jan 21, 2016
9b45440
Subtree merge ws
eljefedelrodeodeljefe Jan 22, 2016
83e066e
ws: removes mocha as a dependency
eljefedelrodeodeljefe Jan 24, 2016
b776eae
ws: preapare for node-native-compile
eljefedelrodeodeljefe Jan 24, 2016
be2f314
ws: fixes requiring
eljefedelrodeodeljefe Jan 24, 2016
e5cc9d3
ws: tests require native module
eljefedelrodeodeljefe Jan 24, 2016
7d70efc
ws: move errorcodes into public module
eljefedelrodeodeljefe Jan 24, 2016
52cb084
ws: removes bufferutil class
eljefedelrodeodeljefe Jan 24, 2016
61090b8
ws: removes bufferpool as internal dep
eljefedelrodeodeljefe Jan 24, 2016
3a63d82
ws: removes unecessary api comments
eljefedelrodeodeljefe Jan 24, 2016
94153d7
ws: removes unecessary api doc and comments, blank lines
eljefedelrodeodeljefe Jan 25, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ws: removes mocha as a dependency
  • Loading branch information
eljefedelrodeodeljefe committed Jan 24, 2016
commit 83e066e561d0b14cf4d33fda189552bcc4d0cf7b
72 changes: 41 additions & 31 deletions test/parallel/test-websockets-bufferpool.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,36 @@
const BufferPool = require('../../lib/internal/websockets/BufferPool');
const assert = require('assert');

describe('BufferPool', function() {
describe('#ctor', function() {
it('allocates pool', function() {
/*'BufferPool'*/
{
/*'#ctor'*/
{
/* 'allocates pool'*/
{
var db = new BufferPool(1000);
assert.equal(db.size, 1000);
});
it('throws TypeError when called without new', function(done) {
// try {
// var db = BufferPool(1000);
// } catch (e) {
// assert.ifError(e)
// done()
// }
done()
});
});
describe('#get', function() {
it('grows the pool if necessary', function() {
}
/*'throws TypeError when called without new'*/
{
try {
var db = BufferPool(1000);
} catch (e) {
assert.ok(e instanceof TypeError);
}
}
}
/*'#get'*/
{
/*'grows the pool if necessary'*/
{
var db = new BufferPool(1000);
var buf = db.get(2000);
assert.ok(db.size > 1000);
assert.equal(db.used, 2000);
assert.equal(buf.length, 2000);
});
it('grows the pool after the first call, if necessary', function() {
}
/*'grows the pool after the first call, if necessary'*/
{
var db = new BufferPool(1000);
var buf = db.get(1000);
assert.equal(db.used, 1000);
Expand All @@ -36,30 +41,35 @@ describe('BufferPool', function() {
assert.equal(db.used, 2000);
assert.ok(db.size > 1000);
assert.equal(buf2.length, 1000);
});
it('grows the pool according to the growStrategy if necessary', function() {
}
/*'grows the pool according to the growStrategy if necessary'*/
{
var db = new BufferPool(1000, function(db, length) {
return db.size + 2345;
});
var buf = db.get(2000);
assert.equal(db.size, 3345);
assert.equal(buf.length, 2000);
});
it('doesnt grow the pool if theres enough room available', function() {
}
/*'doesnt grow the pool if theres enough room available'*/
{
var db = new BufferPool(1000);
var buf = db.get(1000);
assert.equal(db.size, 1000);
assert.equal(buf.length, 1000);
});
});
describe('#reset', function() {
it('shinks the pool', function() {
}
}
/*'#reset'*/
{
/*'shinks the pool'*/
{
var db = new BufferPool(1000);
var buf = db.get(2000);
db.reset(true);
assert.equal(db.size, 1000);
});
it('shrinks the pool according to the shrinkStrategy', function() {
}
/*'shrinks the pool according to the shrinkStrategy'*/
{
var db = new BufferPool(1000, function(db, length) {
return db.used + length;
}, function(db) {
Expand All @@ -68,6 +78,6 @@ describe('BufferPool', function() {
var buf = db.get(2000);
db.reset(true);
assert.equal(db.size, 0);
});
});
});
}
}
}
50 changes: 30 additions & 20 deletions test/parallel/test-websockets-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,63 @@
const Extensions = require('../../lib/internal/websockets/Extensions');
const assert = require('assert');

describe('Extensions', function() {
describe('parse', function() {
it('should parse', function() {
/*'Extensions'*/
{
/*'parse'*/
{
/*'should parse'*/
{
var extensions = Extensions.parse('foo');
assert.deepEqual(extensions, { foo: [{}] });
});
}

it('should parse params', function() {
/*'should parse params'*/
{
var extensions = Extensions.parse('foo; bar; baz=1; bar=2');
assert.deepEqual(extensions, {
foo: [{ bar: [true, '2'], baz: ['1'] }]
});
});
}

it('should parse multiple extensions', function() {
/*'should parse multiple extensions'*/
{
var extensions = Extensions.parse('foo, bar; baz, foo; baz');
assert.deepEqual(extensions, {
foo: [{}, { baz: [true] }],
bar: [{ baz: [true] }]
});
});
}

it('should parse quoted params', function() {
/*'should parse quoted params'*/
{
var extensions = Extensions.parse('foo; bar="hi"');
assert.deepEqual(extensions, {
foo: [{ bar: ['hi'] }]
});
});
});
}
}

describe('format', function() {
it('should format', function() {
/*'format'*/
{
/*'should format'*/
{
var extensions = Extensions.format({ foo: {} });
assert.deepEqual(extensions, 'foo');
});
}

it('should format params', function() {
/*'should format params'*/
{
var extensions = Extensions.format({ foo: { bar: [true, 2], baz: 1 } });
assert.deepEqual(extensions, 'foo; bar; bar=2; baz=1');
});
}

it('should format multiple extensions', function() {
/*'should format multiple extensions'*/
{
var extensions = Extensions.format({
foo: [{}, { baz: true }],
bar: { baz: true }
});
assert.deepEqual(extensions, 'foo, foo; baz, bar; baz');
});
});
});
}
}
}
Loading