Skip to content

Commit d4dbccf

Browse files
committed
test: converted .then to async/await in tests-consent
1 parent ca4a655 commit d4dbccf

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

test/src/tests-consent.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ describe('Consent', function() {
627627
done();
628628
});
629629

630-
it('should have CCPA in payload', done => {
630+
it('should have CCPA in payload', async () => {
631631
const consentState = mParticle.Consent.createConsentState();
632632
const timestamp = new Date().getTime();
633633
const ccpaConsent = mParticle.Consent.createCCPAConsent(
@@ -639,8 +639,7 @@ describe('Consent', function() {
639639
);
640640
consentState.setCCPAConsentState(ccpaConsent);
641641

642-
waitForCondition(hasIdentifyReturned)
643-
.then(() => {
642+
await waitForCondition(hasIdentifyReturned);
644643
const user = mParticle.Identity.getCurrentUser();
645644
user.setConsentState(consentState);
646645

@@ -655,12 +654,9 @@ describe('Consent', function() {
655654
testEvent.consent_state.ccpa.data_sale_opt_out.should.have.property('document', 'consentDoc');
656655
testEvent.consent_state.ccpa.data_sale_opt_out.should.have.property('location', 'location');
657656
testEvent.consent_state.ccpa.data_sale_opt_out.should.have.property('hardware_id', 'hardware');
658-
659-
done();
660-
})
661657
});
662658

663-
it('should have CCPA and GDPR in payload', done => {
659+
it('should have CCPA and GDPR in payload', async () => {
664660
const consentState = mParticle.Consent.createConsentState();
665661
const timestamp = new Date().getTime();
666662
const ccpaConsent = mParticle.Consent.createCCPAConsent(
@@ -679,8 +675,7 @@ describe('Consent', function() {
679675
);
680676
consentState.setCCPAConsentState(ccpaConsent);
681677
consentState.addGDPRConsentState('test purpose', gdprConsent);
682-
waitForCondition(hasIdentifyReturned)
683-
.then(() => {
678+
await waitForCondition(hasIdentifyReturned);
684679

685680
const user = mParticle.Identity.getCurrentUser();
686681
user.setConsentState(consentState);
@@ -706,9 +701,6 @@ describe('Consent', function() {
706701
testEvent.consent_state.gdpr['test purpose'].should.have.property('document', 'consentDoc');
707702
testEvent.consent_state.gdpr['test purpose'].should.have.property('location', 'location');
708703
testEvent.consent_state.gdpr['test purpose'].should.have.property('hardware_id', 'hardware');
709-
710-
done();
711-
})
712704
});
713705

714706
// TODO: Deprecate in next major version

0 commit comments

Comments
 (0)