Skip to content

Commit

Permalink
tests for PR #14
Browse files Browse the repository at this point in the history
related with #14
  • Loading branch information
José Moreira committed May 21, 2015
1 parent 830643f commit 67b52fa
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/proxy-protocol.regexp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,42 @@ describe( "PROXY Protocol regexp tests", function () {

});

describe( "Ports", function () {

function testPort ( port, ok ) {
it( 'port '+ port +' should ' + ( ok ? '' : 'NOT' ) + ' be ok', function () {
var res = test( 'PROXY TCP4 127.0.0.1 127.0.0.1 '+ port +' '+ port );
if ( ok )
expect( res ).to.be.ok;
else {
expect( res ).to.not.be.ok;
}
});
}

function testPorts( ports, ok ) {
ports.forEach(function ( port ) {
testPort( port, ok );
});
}


// Tests for PR #14
testPorts([
6,
65,
655,
6553,
65535,
], true );
testPorts([
65536,
65545,
65635,
66535,
75535,
], false );

});

});

0 comments on commit 67b52fa

Please sign in to comment.