test: Remove set timeouts from tests and other cleanup#967
Open
rmi22186 wants to merge 2 commits intofeat/SQDSDKS-6991-cookie-sync-gdpr-2from
Open
test: Remove set timeouts from tests and other cleanup#967rmi22186 wants to merge 2 commits intofeat/SQDSDKS-6991-cookie-sync-gdpr-2from
rmi22186 wants to merge 2 commits intofeat/SQDSDKS-6991-cookie-sync-gdpr-2from
Conversation
alexs-mparticle
requested changes
Jan 22, 2025
test/src/tests-cookie-syncing.ts
Outdated
Comment on lines
164
to
167
| await waitForCondition(() => { | ||
| return ( | ||
| mParticle.Identity.getCurrentUser()?.getMPID() === 'otherMPID' | ||
| ); |
Collaborator
There was a problem hiding this comment.
Suggested change
| 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(() => { |
Collaborator
There was a problem hiding this comment.
You may need to modify some of the other lines as well to get this to work.
Suggested change
| 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) |
Collaborator
There was a problem hiding this comment.
Suggested change
| 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() { |
Collaborator
There was a problem hiding this comment.
Nit: See if you can easily replace these function references with () => if possible. If not, no biggie.
Member
Author
There was a problem hiding this comment.
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) |
Collaborator
There was a problem hiding this comment.
Suggested change
| await waitForCondition(hasIdentifyReturned) | |
| await waitForCondition(hasIdentifyReturned); |
| window.mParticle.init(apiKey, window.mParticle.config); | ||
|
|
||
| window.mParticle.logEvent('Blocked event'); | ||
| await waitForCondition(hasIdentifyReturned) |
Collaborator
There was a problem hiding this comment.
Suggested change
| await waitForCondition(hasIdentifyReturned) | |
| await waitForCondition(hasIdentifyReturned); |
rmi22186
commented
Jan 22, 2025
test/src/tests-cookie-syncing.ts
Outdated
| }); | ||
| } | ||
|
|
||
| return element; |
|
alexs-mparticle
approved these changes
Jan 27, 2025
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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)