@@ -21,9 +21,9 @@ const hasIdentifyReturned = () => {
2121 return window . mParticle . Identity . getCurrentUser ( ) ?. getMPID ( ) === testMPID ;
2222} ;
2323
24- describe ( 'feature-flags' , function ( ) {
25- describe ( 'user audiences' , function ( ) {
26- beforeEach ( function ( ) {
24+ describe ( 'feature-flags' , ( ) => {
25+ describe ( 'user audiences' , ( ) => {
26+ beforeEach ( ( ) => {
2727 fetchMock . post ( urls . events , 200 ) ;
2828
2929 fetchMockSuccess ( urls . identify , {
@@ -38,7 +38,7 @@ describe('feature-flags', function() {
3838 fetchMock . restore ( ) ;
3939 } ) ;
4040
41- it ( 'should not be able to access user audience API if feature flag is false' , function ( ) {
41+ it ( 'should not be able to access user audience API if feature flag is false' , async ( ) => {
4242 window . mParticle . config . flags = {
4343 audienceAPI : 'False'
4444 } ;
@@ -47,19 +47,18 @@ describe('feature-flags', function() {
4747
4848 // initialize mParticle with feature flag
4949 window . mParticle . init ( apiKey , window . mParticle . config ) ;
50- waitForCondition ( hasIdentifyReturned )
51- . then ( ( ) => {
50+ await waitForCondition ( hasIdentifyReturned ) ;
51+
5252 const bond = sinon . spy ( window . mParticle . getInstance ( ) . Logger , 'error' ) ;
5353 window . mParticle . Identity . getCurrentUser ( ) . getUserAudiences ( ) ;
5454
5555 bond . called . should . eql ( true ) ;
5656 bond . getCalls ( ) [ 0 ] . args [ 0 ] . should . eql (
5757 Constants . Messages . ErrorMessages . AudienceAPINotEnabled
5858 ) ;
59- } )
6059 } ) ;
6160
62- it ( 'should be able to call user audience API if feature flag is false' , function ( ) {
61+ it ( 'should be able to call user audience API if feature flag is false' , async ( ) => {
6362 const userAudienceUrl = `https://${ Constants . DefaultBaseUrls . userAudienceUrl } ${ apiKey } /audience` ;
6463 const audienceMembershipServerResponse = {
6564 ct : 1710441407915 ,
@@ -88,15 +87,14 @@ describe('feature-flags', function() {
8887
8988 // initialize mParticle with feature flag
9089 window . mParticle . init ( apiKey , window . mParticle . config ) ;
91- waitForCondition ( hasIdentifyReturned )
92- . then ( ( ) => {
90+ await waitForCondition ( hasIdentifyReturned ) ;
91+
9392 const bond = sinon . spy ( window . mParticle . getInstance ( ) . Logger , 'error' ) ;
9493
9594 window . mParticle . Identity . getCurrentUser ( ) . getUserAudiences ( ( result ) => {
9695 console . log ( result ) ;
9796 } ) ;
9897 bond . called . should . eql ( false ) ;
99- } )
10098 } ) ;
10199 } ) ;
102100
0 commit comments