-
Notifications
You must be signed in to change notification settings - Fork 55
test: Remove set timeouts from tests and other cleanup #967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/SQDSDKS-6991-cookie-sync-gdpr-2
Are you sure you want to change the base?
test: Remove set timeouts from tests and other cleanup #967
Conversation
test/src/tests-cookie-syncing.ts
Outdated
| await waitForCondition(() => { | ||
| return ( | ||
| mParticle.Identity.getCurrentUser()?.getMPID() === 'otherMPID' | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await waitForCondition(() => { | |
| return ( | |
| mParticle.Identity.getCurrentUser()?.getMPID() === 'otherMPID' | |
| ); | |
| await waitForCondition(() => mParticle.Identity.getCurrentUser()?.getMPID() === 'otherMPID'); |
test/src/tests-cookie-syncing.ts
Outdated
| mParticle.Identity.login({ | ||
| userIdentities: { customerid: 'abc' }, | ||
| }); | ||
| await waitForCondition(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may need to modify some of the other lines as well to get this to work.
| await waitForCondition(() => { | |
| await waitForCondition(() => mParticle.Identity.getCurrentUser()?.getMPID() === 'MPID1'); |
test/src/tests-cookie-syncing.ts
Outdated
| ).to.equal(1); | ||
| const data = mParticle.getInstance()._Persistence.getLocalStorage(); | ||
| data[testMPID].csd.should.have.property('5'); | ||
| await waitForCondition(hasIdentifyReturned) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await waitForCondition(hasIdentifyReturned) | |
| await waitForCondition(hasIdentifyReturned); |
| }); | ||
|
|
||
| it("should disable cookie sync if 'Do Not Forward' when 'Consent Rejected' is selected and user consent is rejected", function(done) { | ||
| it("should disable cookie sync if 'Do Not Forward' when 'Consent Rejected' is selected and user consent is rejected", function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: See if you can easily replace these function references with () => if possible. If not, no biggie.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea let's do that in the future. i already did stuff that's out of scope...and it's getting a bit late :)
test/src/tests-cookie-syncing.ts
Outdated
|
|
||
| mParticle.Identity.getCurrentUser().setConsentState( | ||
| falseConsentState | ||
| await waitForCondition(hasIdentifyReturned) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await waitForCondition(hasIdentifyReturned) | |
| await waitForCondition(hasIdentifyReturned); |
| window.mParticle.init(apiKey, window.mParticle.config); | ||
|
|
||
| window.mParticle.logEvent('Blocked event'); | ||
| await waitForCondition(hasIdentifyReturned) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await waitForCondition(hasIdentifyReturned) | |
| await waitForCondition(hasIdentifyReturned); |
test/src/tests-cookie-syncing.ts
Outdated
| }); | ||
| } | ||
|
|
||
| return element; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
|


Instructions
developmentSummary
In this PR, there is a lot of cleanup
setTimeoutfrom the mock foronloadand have it immediately call the callback, to avoid having setTImeout elsewhere in the cookie sync manager which has historically been very flakey.Shouldand replaced withexpecthasConfigurationReturnedfrom Utils to keep things DRYThere is plenty more to do, but I was already going beyond the scope of this jira ticket.
Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)