testing/xpcshell/node-http2/node_modules/http2-protocol/test/endpoint.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:9c1838cbea55
1 var expect = require('chai').expect;
2 var util = require('./util');
3
4 var endpoint = require('../lib/endpoint');
5 var Endpoint = endpoint.Endpoint;
6
7 var settings = {
8 SETTINGS_MAX_CONCURRENT_STREAMS: 100,
9 SETTINGS_INITIAL_WINDOW_SIZE: 100000
10 };
11
12 describe('endpoint.js', function() {
13 describe('scenario', function() {
14 describe('connection setup', function() {
15 it('should work as expected', function(done) {
16 var c = new Endpoint(util.log.child({ role: 'client' }), 'CLIENT', settings);
17 var s = new Endpoint(util.log.child({ role: 'client' }), 'SERVER', settings);
18
19 util.log.debug('Test initialization over, starting piping.');
20 c.pipe(s).pipe(c);
21
22 setTimeout(function() {
23 // If there are no exception until this, then we're done
24 done();
25 }, 10);
26 });
27 });
28 });
29 describe('bunyan serializer', function() {
30 describe('`e`', function() {
31 var format = endpoint.serializers.e;
32 it('should assign a unique ID to each endpoint', function() {
33 var c = new Endpoint(util.log.child({ role: 'client' }), 'CLIENT', settings);
34 var s = new Endpoint(util.log.child({ role: 'client' }), 'SERVER', settings);
35 expect(format(c)).to.not.equal(format(s));
36 expect(format(c)).to.equal(format(c));
37 expect(format(s)).to.equal(format(s));
38 });
39 });
40 });
41 });

mercurial