-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathendpoint.js
More file actions
57 lines (52 loc) · 1.59 KB
/
endpoint.js
File metadata and controls
57 lines (52 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var expect = require('chai').expect;
var util = require('./util');
var endpoint = require('../lib/protocol/endpoint');
var Endpoint = endpoint.Endpoint;
var settings = {
SETTINGS_MAX_CONCURRENT_STREAMS: 100,
SETTINGS_INITIAL_WINDOW_SIZE: 100000
};
describe('endpoint.js', function() {
describe('scenario', function() {
describe('connection setup', function() {
it('should work as expected', function(done) {
var c = new Endpoint({
log: util.log.child({role: 'client'}),
role: 'CLIENT',
settings: settings
});
var s = new Endpoint({
log: util.log.child({role: 'client'}),
role: 'SERVER',
settings: settings
});
util.log.debug('Test initialization over, starting piping.');
c.pipe(s).pipe(c);
setTimeout(function() {
// If there are no exception until this, then we're done
done();
}, 10);
});
});
});
describe('bunyan serializer', function() {
describe('`e`', function() {
var format = endpoint.serializers.e;
it('should assign a unique ID to each endpoint', function() {
var c = new Endpoint({
log: util.log.child({role: 'client'}),
role: 'CLIENT',
settings: settings
});
var s = new Endpoint({
log: util.log.child({role: 'client'}),
role: 'SERVER',
settings: settings
});
expect(format(c)).to.not.equal(format(s));
expect(format(c)).to.equal(format(c));
expect(format(s)).to.equal(format(s));
});
});
});
});