@@ -1117,26 +1117,6 @@ describe('Segment.io', function() {
1117
1117
}
1118
1118
1119
1119
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
-
1140
1120
it ( 'should obtain crossDomainId' , function ( ) {
1141
1121
server . respondWith (
1142
1122
'GET' ,
@@ -1194,6 +1174,15 @@ describe('Segment.io', function() {
1194
1174
'{ "id": null }'
1195
1175
]
1196
1176
) ;
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
+ ) ;
1197
1186
if ( segment . options . saveCrossDomainIdInLocalStorage ) {
1198
1187
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 / , [
1199
1188
200 ,
@@ -1237,12 +1226,17 @@ describe('Segment.io', function() {
1237
1226
segment . options . apiKey ,
1238
1227
[ 500 , { 'Content-Type' : 'application/json' } , '' ]
1239
1228
) ;
1229
+ server . respondWith (
1230
+ 'GET' ,
1231
+ 'https://localhost/v1/id/' + segment . options . apiKey ,
1232
+ [ 500 , { 'Content-Type' : 'application/json' } , '' ]
1233
+ ) ;
1240
1234
server . respond ( ) ;
1241
1235
1242
1236
var identify = segment . onidentify . args [ 0 ] ;
1243
1237
analytics . assert ( ! identify ) ;
1244
1238
analytics . assert ( ! res ) ;
1245
- analytics . assert ( err === 'Internal Server Error' ) ;
1239
+ analytics . assert . equal ( err , 'Internal Server Error' ) ;
1246
1240
1247
1241
assert . equal ( segment . getCachedCrossDomainId ( ) , null ) ;
1248
1242
} ) ;
@@ -1270,6 +1264,15 @@ describe('Segment.io', function() {
1270
1264
'{ "id": null }'
1271
1265
]
1272
1266
) ;
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
+ ) ;
1273
1276
server . respond ( ) ;
1274
1277
1275
1278
var identify = segment . onidentify . args [ 0 ] ;
0 commit comments