@@ -42,22 +42,21 @@ describe('webex-core', () => {
4242 } )
4343 ) ;
4444
45- beforeEach ( 'create webex instance' , ( ) => {
45+ beforeEach ( 'create webex instance' , async ( ) => {
4646 webex = new WebexCore ( { credentials : { supertoken : webexUser . token } } ) ;
4747 webexEU = new WebexCore ( { credentials : { supertoken : webexUserEU . token } } ) ;
4848 services = webex . internal . services ;
4949 servicesEU = webexEU . internal . services ;
5050 catalog = services . _getCatalog ( ) ;
5151
52- return Promise . all ( [
52+ await Promise . all ( [
5353 services . waitForCatalog ( 'postauth' , 10 ) ,
5454 servicesEU . waitForCatalog ( 'postauth' , 10 ) ,
55- ] ) . then ( ( ) =>
56- services . updateServices ( {
57- from : 'limited' ,
58- query : { userId : webexUser . id } ,
59- } )
60- ) ;
55+ ] ) ;
56+ await services . updateServices ( {
57+ from : 'limited' ,
58+ query : { userId : webexUser . id } ,
59+ } )
6160 } ) ;
6261
6362 describe ( '#_getCatalog()' , ( ) => {
@@ -87,14 +86,14 @@ describe('webex-core', () => {
8786 let testUrlTemplate ;
8887 let testUrl ;
8988
90- beforeEach ( 'load test url' , ( ) => {
89+ beforeEach ( 'load test url' , async ( ) => {
9190 testUrlTemplate = {
9291 defaultUrl : 'https://www.example.com/api/v1' ,
9392 hosts : [ ] ,
9493 name : 'exampleValid' ,
9594 } ;
9695 testUrl = new ServiceUrl ( testUrlTemplate ) ;
97- catalog . _loadServiceUrls ( 'preauth' , [ testUrl ] ) ;
96+ await catalog . _loadServiceUrls ( 'preauth' , [ testUrl ] ) ;
9897 } ) ;
9998
10099 afterEach ( 'unload test url' , ( ) => {
@@ -532,7 +531,7 @@ describe('webex-core', () => {
532531 let testUrl ;
533532 let testUrlTemplate ;
534533
535- beforeEach ( 'load test url' , ( ) => {
534+ beforeEach ( 'load test url' , async ( ) => {
536535 testUrlTemplate = {
537536 defaultUrl : 'https://www.example.com/api/v1' ,
538537 hosts : [
@@ -553,7 +552,7 @@ describe('webex-core', () => {
553552 name : 'exampleValid' ,
554553 } ;
555554 testUrl = new ServiceUrl ( testUrlTemplate ) ;
556- catalog . _loadServiceUrls ( 'preauth' , [ testUrl ] ) ;
555+ await catalog . _loadServiceUrls ( 'preauth' , [ testUrl ] ) ;
557556 } ) ;
558557
559558 it ( 'converts the url to a priority host url' , ( ) => {
@@ -734,18 +733,15 @@ describe('webex-core', () => {
734733 done ( ) ;
735734 } ) ;
736735 } ) ;
737- it ( 'updates the limited catalog when query param mode is provided' , ( done ) => {
736+ it ( 'updates the limited catalog when query param mode is provided' , async ( ) => {
738737 catalog . serviceGroups . preauth = [ ] ;
739738
740- services
739+ await services
741740 . updateServices ( {
742741 from : 'limited' ,
743742 query : { mode : 'DEFAULT_BY_PROXIMITY' } ,
744- } )
745- . then ( ( ) => {
746- assert . isAbove ( catalog . serviceGroups . preauth . length , 0 ) ;
747- done ( ) ;
748743 } ) ;
744+ assert . isAbove ( catalog . serviceGroups . preauth . length , 0 ) ;
749745 } ) ;
750746 it ( 'does not update the limited catalog when nothing is provided' , ( ) => {
751747 catalog . serviceGroups . preauth = [ ] ;
@@ -793,11 +789,12 @@ describe('webex-core', () => {
793789 } ) ;
794790
795791 describe ( '#fetchClientRegionInfo()' , ( ) => {
796- it ( 'returns client region info' , ( ) =>
792+ it ( 'returns client region info' , async ( ) => {
797793 services . fetchClientRegionInfo ( ) . then ( ( r ) => {
798794 assert . isDefined ( r . countryCode ) ;
799795 assert . isDefined ( r . timezone ) ;
800- } ) ) ;
796+ } )
797+ } ) ;
801798 } ) ;
802799
803800 describe ( '#validateUser()' , ( ) => {
@@ -870,21 +867,21 @@ describe('webex-core', () => {
870867 assert . equal ( Object . keys ( unauthServices . list ( false , 'postauth' ) ) . length , 0 ) ;
871868 } ) ) ;
872869
873- it ( 'validates new user with activationOptions suppressEmail false' , ( ) =>
874- unauthServices
870+ it ( 'validates new user with activationOptions suppressEmail false' , async ( ) => {
871+ const r = await unauthServices
875872 . validateUser ( {
876873 email : `Collabctg+webex-js-sdk-${ uuid . v4 ( ) } @gmail.com` ,
877874 activationOptions : { suppressEmail : false } ,
878- } )
879- . then ( ( r ) => {
880- assert . hasAllKeys ( r , [ 'activated' , 'exists' , 'user' , 'details' ] ) ;
881- assert . equal ( r . activated , false ) ;
882- assert . equal ( r . exists , false ) ;
883- assert . equal ( r . user . verificationEmailTriggered , true ) ;
884- assert . isAbove ( Object . keys ( unauthServices . list ( false , 'preauth' ) ) . length , 0 ) ;
885- assert . equal ( Object . keys ( unauthServices . list ( false , 'signin' ) ) . length , 0 ) ;
886- assert . equal ( Object . keys ( unauthServices . list ( false , 'postauth' ) ) . length , 0 ) ;
887- } ) ) ;
875+ } ) ;
876+
877+ assert . hasAllKeys ( r , [ 'activated' , 'exists' , 'user' , 'details' ] ) ;
878+ assert . equal ( r . activated , false ) ;
879+ assert . equal ( r . exists , false ) ;
880+ assert . equal ( r . user . verificationEmailTriggered , true ) ;
881+ assert . isAbove ( Object . keys ( unauthServices . list ( false , 'preauth' ) ) . length , 0 ) ;
882+ assert . equal ( Object . keys ( unauthServices . list ( false , 'signin' ) ) . length , 0 ) ;
883+ assert . equal ( Object . keys ( unauthServices . list ( false , 'postauth' ) ) . length , 0 ) ;
884+ } ) ;
888885
889886 it ( 'validates new user with activationOptions suppressEmail true' , ( ) =>
890887 unauthServices
0 commit comments