@@ -26,14 +26,18 @@ describe('createDomain', () => {
2626 host : 'localhost' ,
2727 port : port1 ,
2828 } ,
29- expected : `http://localhost:${ port1 } ` ,
29+ expected : [
30+ `http://localhost:${ port1 } ` ,
31+ `http://127.0.0.1:${ port1 } ` ,
32+ `http://[::1]:${ port1 } ` ,
33+ ] ,
3034 } ,
3135 {
3236 name : 'no host option' ,
3337 options : {
3438 port : port1 ,
3539 } ,
36- expected : `http://localhost :${ port1 } ` ,
40+ expected : [ `http://0.0.0.0 :${ port1 } ` , `http://[::]: ${ port1 } ` ] ,
3741 } ,
3842 {
3943 name : 'https' ,
@@ -42,7 +46,11 @@ describe('createDomain', () => {
4246 port : port1 ,
4347 https : true ,
4448 } ,
45- expected : `https://localhost:${ port1 } ` ,
49+ expected : [
50+ `https://localhost:${ port1 } ` ,
51+ `https://127.0.0.1:${ port1 } ` ,
52+ `https://[::1]:${ port1 } ` ,
53+ ] ,
4654 timeout : 60000 ,
4755 } ,
4856 {
@@ -52,7 +60,7 @@ describe('createDomain', () => {
5260 port : port1 ,
5361 public : 'myhost.test' ,
5462 } ,
55- expected : 'http://myhost.test' ,
63+ expected : [ 'http://myhost.test' ] ,
5664 } ,
5765 {
5866 name : 'override with public (port)' ,
@@ -61,7 +69,7 @@ describe('createDomain', () => {
6169 port : port1 ,
6270 public : `myhost.test:${ port2 } ` ,
6371 } ,
64- expected : `http://myhost.test:${ port2 } ` ,
72+ expected : [ `http://myhost.test:${ port2 } ` ] ,
6573 } ,
6674 {
6775 name : 'override with public (protocol)' ,
@@ -70,7 +78,7 @@ describe('createDomain', () => {
7078 port : port1 ,
7179 public : 'https://myhost.test' ,
7280 } ,
73- expected : 'https://myhost.test' ,
81+ expected : [ 'https://myhost.test' ] ,
7482 } ,
7583 {
7684 name : 'override with public (protocol + port)' ,
@@ -79,15 +87,20 @@ describe('createDomain', () => {
7987 port : port1 ,
8088 public : `https://myhost.test:${ port2 } ` ,
8189 } ,
82- expected : `https://myhost.test:${ port2 } ` ,
90+ expected : [ `https://myhost.test:${ port2 } ` ] ,
8391 } ,
8492 {
8593 name : 'localIp' ,
8694 options : {
8795 useLocalIp : true ,
8896 port : port1 ,
8997 } ,
90- expected : `http://${ internalIp . v4 . sync ( ) || 'localhost' } :${ port1 } ` ,
98+ expected : [
99+ `http://${ internalIp . v4 . sync ( ) } :${ port1 } ` ,
100+ `https://localhost:${ port1 } ` ,
101+ `https://127.0.0.1:${ port1 } ` ,
102+ `https://[::1]:${ port1 } ` ,
103+ ] ,
91104 } ,
92105 ] ;
93106
@@ -105,7 +118,7 @@ describe('createDomain', () => {
105118
106119 const domain = createDomain ( options , server . listeningApp ) ;
107120
108- if ( domain !== expected ) {
121+ if ( ! expected . includes ( domain ) ) {
109122 done ( `generated domain ${ domain } doesn't match expected ${ expected } ` ) ;
110123 } else {
111124 done ( ) ;
0 commit comments