@@ -1117,26 +1117,6 @@ describe('Segment.io', function() {
11171117 }
11181118
11191119 describe ( 'with ' + scenario , function ( ) {
1120- it ( 'should generate xid locally if there is only one (current hostname) server' , function ( ) {
1121- segment . options . crossDomainIdServers = [ 'localhost' ] ;
1122- segment . options . saveCrossDomainIdInLocalStorage =
1123- cases [ scenario ] ;
1124-
1125- var res = null ;
1126- segment . retrieveCrossDomainId ( function ( err , response ) {
1127- res = response ;
1128- } ) ;
1129-
1130- var identify = segment . onidentify . args [ 0 ] ;
1131- var crossDomainId = identify [ 0 ] . traits ( ) . crossDomainId ;
1132- analytics . assert ( crossDomainId ) ;
1133-
1134- analytics . assert ( res . crossDomainId === crossDomainId ) ;
1135- analytics . assert ( res . fromDomain === 'localhost' ) ;
1136-
1137- assert . equal ( segment . getCachedCrossDomainId ( ) , crossDomainId ) ;
1138- } ) ;
1139-
11401120 it ( 'should obtain crossDomainId' , function ( ) {
11411121 server . respondWith (
11421122 'GET' ,
@@ -1194,6 +1174,15 @@ describe('Segment.io', function() {
11941174 '{ "id": null }'
11951175 ]
11961176 ) ;
1177+ server . respondWith (
1178+ 'GET' ,
1179+ 'https://localhost/v1/id/' + segment . options . apiKey ,
1180+ [
1181+ 200 ,
1182+ { 'Content-Type' : 'application/json' } ,
1183+ '{ "id": null }'
1184+ ]
1185+ ) ;
11971186 if ( segment . options . saveCrossDomainIdInLocalStorage ) {
11981187 server . respondWith ( 'GET' , / h t t p s : \/ \/ l o c a l h o s t \/ v 1 \/ s a v e I d / , [
11991188 200 ,
@@ -1237,12 +1226,17 @@ describe('Segment.io', function() {
12371226 segment . options . apiKey ,
12381227 [ 500 , { 'Content-Type' : 'application/json' } , '' ]
12391228 ) ;
1229+ server . respondWith (
1230+ 'GET' ,
1231+ 'https://localhost/v1/id/' + segment . options . apiKey ,
1232+ [ 500 , { 'Content-Type' : 'application/json' } , '' ]
1233+ ) ;
12401234 server . respond ( ) ;
12411235
12421236 var identify = segment . onidentify . args [ 0 ] ;
12431237 analytics . assert ( ! identify ) ;
12441238 analytics . assert ( ! res ) ;
1245- analytics . assert ( err === 'Internal Server Error' ) ;
1239+ analytics . assert . equal ( err , 'Internal Server Error' ) ;
12461240
12471241 assert . equal ( segment . getCachedCrossDomainId ( ) , null ) ;
12481242 } ) ;
@@ -1270,6 +1264,15 @@ describe('Segment.io', function() {
12701264 '{ "id": null }'
12711265 ]
12721266 ) ;
1267+ server . respondWith (
1268+ 'GET' ,
1269+ 'https://localhost/v1/id/' + segment . options . apiKey ,
1270+ [
1271+ 200 ,
1272+ { 'Content-Type' : 'application/json' } ,
1273+ '{ "id": null }'
1274+ ]
1275+ ) ;
12731276 server . respond ( ) ;
12741277
12751278 var identify = segment . onidentify . args [ 0 ] ;
0 commit comments