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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial