2
2
var expect = require ( 'expect.js' ) ;
3
3
var eio = require ( '../' ) ;
4
4
5
+ var expectedPort = global . location && 'https:' === location . protocol ? '443' : '80' ;
6
+
5
7
describe ( 'engine.io-client' , function ( ) {
6
8
var open ;
7
9
@@ -45,7 +47,7 @@ describe('engine.io-client', function () {
45
47
it ( 'should properly parse a host without port' , function ( ) {
46
48
var client = eio ( { host : 'localhost' } ) ;
47
49
expect ( client . hostname ) . to . be ( 'localhost' ) ;
48
- expect ( client . port ) . to . be ( '80' ) ;
50
+ expect ( client . port ) . to . be ( expectedPort ) ;
49
51
} ) ;
50
52
51
53
it ( 'should properly parse a host with port' , function ( ) {
@@ -69,7 +71,7 @@ describe('engine.io-client', function () {
69
71
it ( 'should properly parse an IPv6 host without port (1/2)' , function ( ) {
70
72
var client = eio ( { host : '[::1]' } ) ;
71
73
expect ( client . hostname ) . to . be ( '::1' ) ;
72
- expect ( client . port ) . to . be ( '80' ) ;
74
+ expect ( client . port ) . to . be ( expectedPort ) ;
73
75
} ) ;
74
76
75
77
it ( 'should properly parse an IPv6 host without port (2/2)' , function ( ) {
@@ -87,6 +89,6 @@ describe('engine.io-client', function () {
87
89
it ( 'should properly parse an IPv6 host without brace' , function ( ) {
88
90
var client = eio ( { host : '::1' } ) ;
89
91
expect ( client . hostname ) . to . be ( '::1' ) ;
90
- expect ( client . port ) . to . be ( '80' ) ;
92
+ expect ( client . port ) . to . be ( expectedPort ) ;
91
93
} ) ;
92
94
} ) ;
0 commit comments