michael@0: var expect = require('chai').expect; michael@0: var util = require('./util'); michael@0: michael@0: var endpoint = require('../lib/endpoint'); michael@0: var Endpoint = endpoint.Endpoint; michael@0: michael@0: var settings = { michael@0: SETTINGS_MAX_CONCURRENT_STREAMS: 100, michael@0: SETTINGS_INITIAL_WINDOW_SIZE: 100000 michael@0: }; michael@0: michael@0: describe('endpoint.js', function() { michael@0: describe('scenario', function() { michael@0: describe('connection setup', function() { michael@0: it('should work as expected', function(done) { michael@0: var c = new Endpoint(util.log.child({ role: 'client' }), 'CLIENT', settings); michael@0: var s = new Endpoint(util.log.child({ role: 'client' }), 'SERVER', settings); michael@0: michael@0: util.log.debug('Test initialization over, starting piping.'); michael@0: c.pipe(s).pipe(c); michael@0: michael@0: setTimeout(function() { michael@0: // If there are no exception until this, then we're done michael@0: done(); michael@0: }, 10); michael@0: }); michael@0: }); michael@0: }); michael@0: describe('bunyan serializer', function() { michael@0: describe('`e`', function() { michael@0: var format = endpoint.serializers.e; michael@0: it('should assign a unique ID to each endpoint', function() { michael@0: var c = new Endpoint(util.log.child({ role: 'client' }), 'CLIENT', settings); michael@0: var s = new Endpoint(util.log.child({ role: 'client' }), 'SERVER', settings); michael@0: expect(format(c)).to.not.equal(format(s)); michael@0: expect(format(c)).to.equal(format(c)); michael@0: expect(format(s)).to.equal(format(s)); michael@0: }); michael@0: }); michael@0: }); michael@0: });