@@ -180,18 +180,26 @@ describe('mapbox credentials', function() {
180180 } ) ;
181181
182182 it ( 'should throw error if token is invalid' , function ( done ) {
183+ var cnt = 0 ;
184+
183185 Plotly . plot ( gd , [ {
184186 type : 'scattermapbox' ,
185187 lon : [ 10 , 20 , 30 ] ,
186188 lat : [ 10 , 20 , 30 ]
187189 } ] , { } , {
188190 mapboxAccessToken : dummyToken
189191 } ) . catch ( function ( err ) {
192+ cnt ++ ;
190193 expect ( err ) . toEqual ( new Error ( constants . mapOnErrorMsg ) ) ;
191- } ) . then ( done ) ;
194+ } ) . then ( function ( ) {
195+ expect ( cnt ) . toEqual ( 1 ) ;
196+ done ( ) ;
197+ } ) ;
192198 } ) ;
193199
194200 it ( 'should use access token in mapbox layout options if present' , function ( done ) {
201+ var cnt = 0 ;
202+
195203 Plotly . plot ( gd , [ {
196204 type : 'scattermapbox' ,
197205 lon : [ 10 , 20 , 30 ] ,
@@ -202,7 +210,10 @@ describe('mapbox credentials', function() {
202210 }
203211 } , {
204212 mapboxAccessToken : dummyToken
213+ } ) . catch ( function ( ) {
214+ cnt ++ ;
205215 } ) . then ( function ( ) {
216+ expect ( cnt ) . toEqual ( 0 ) ;
206217 expect ( gd . _fullLayout . mapbox . accesstoken ) . toEqual ( MAPBOX_ACCESS_TOKEN ) ;
207218 done ( ) ;
208219 } ) ;
@@ -493,21 +504,19 @@ describe('mapbox plots', function() {
493504 } ) ;
494505
495506 it ( 'should be able to update the access token' , function ( done ) {
496- var promise = Plotly . relayout ( gd , 'mapbox.accesstoken' , 'wont-work' ) ;
497-
498- promise . catch ( function ( err ) {
507+ Plotly . relayout ( gd , 'mapbox.accesstoken' , 'wont-work' ) . catch ( function ( err ) {
499508 expect ( gd . _fullLayout . mapbox . accesstoken ) . toEqual ( 'wont-work' ) ;
500509 expect ( err ) . toEqual ( new Error ( constants . mapOnErrorMsg ) ) ;
501- } ) ;
510+ expect ( gd . _promises . length ) . toEqual ( 1 ) ;
502511
503- promise . then ( function ( ) {
504512 return Plotly . relayout ( gd , 'mapbox.accesstoken' , MAPBOX_ACCESS_TOKEN ) ;
505513 } ) . then ( function ( ) {
506514 expect ( gd . _fullLayout . mapbox . accesstoken ) . toEqual ( MAPBOX_ACCESS_TOKEN ) ;
507- } ) . then ( done ) ;
515+ expect ( gd . _promises . length ) . toEqual ( 0 ) ;
516+ done ( ) ;
517+ } ) ;
508518 } ) ;
509519
510-
511520 it ( 'should be able to update traces' , function ( done ) {
512521 function assertDataPts ( lengths ) {
513522 var lines = getGeoJsonData ( gd , 'lines' ) ,
0 commit comments