1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/xpcshell/node-http2/node_modules/http2-protocol/test/endpoint.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +var expect = require('chai').expect; 1.5 +var util = require('./util'); 1.6 + 1.7 +var endpoint = require('../lib/endpoint'); 1.8 +var Endpoint = endpoint.Endpoint; 1.9 + 1.10 +var settings = { 1.11 + SETTINGS_MAX_CONCURRENT_STREAMS: 100, 1.12 + SETTINGS_INITIAL_WINDOW_SIZE: 100000 1.13 +}; 1.14 + 1.15 +describe('endpoint.js', function() { 1.16 + describe('scenario', function() { 1.17 + describe('connection setup', function() { 1.18 + it('should work as expected', function(done) { 1.19 + var c = new Endpoint(util.log.child({ role: 'client' }), 'CLIENT', settings); 1.20 + var s = new Endpoint(util.log.child({ role: 'client' }), 'SERVER', settings); 1.21 + 1.22 + util.log.debug('Test initialization over, starting piping.'); 1.23 + c.pipe(s).pipe(c); 1.24 + 1.25 + setTimeout(function() { 1.26 + // If there are no exception until this, then we're done 1.27 + done(); 1.28 + }, 10); 1.29 + }); 1.30 + }); 1.31 + }); 1.32 + describe('bunyan serializer', function() { 1.33 + describe('`e`', function() { 1.34 + var format = endpoint.serializers.e; 1.35 + it('should assign a unique ID to each endpoint', function() { 1.36 + var c = new Endpoint(util.log.child({ role: 'client' }), 'CLIENT', settings); 1.37 + var s = new Endpoint(util.log.child({ role: 'client' }), 'SERVER', settings); 1.38 + expect(format(c)).to.not.equal(format(s)); 1.39 + expect(format(c)).to.equal(format(c)); 1.40 + expect(format(s)).to.equal(format(s)); 1.41 + }); 1.42 + }); 1.43 + }); 1.44 +});