Skip to content

Conversation

@rmi22186
Copy link
Member

Instructions

  1. PR target branch should be against development
  2. PR title name should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-title-check.yml
  3. PR branch prefix should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-branch-check-name.yml

Summary

In this PR, there is a lot of cleanup

  • The main refactor is in cookie sync. I removed the setTimeout from the mock for onload and have it immediately call the callback, to avoid having setTImeout elsewhere in the cookie sync manager which has historically been very flakey.
  • removed Should and replaced with expect
  • used hasConfigurationReturned from Utils to keep things DRY
  • cleaned up function() {} to () => {} in some places

There is plenty more to do, but I was already going beyond the scope of this jira ticket.

Testing Plan

  • Was this tested locally? If not, explain why.

Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)

Comment on lines 164 to 167
await waitForCondition(() => {
return (
mParticle.Identity.getCurrentUser()?.getMPID() === 'otherMPID'
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await waitForCondition(() => {
return (
mParticle.Identity.getCurrentUser()?.getMPID() === 'otherMPID'
);
await waitForCondition(() => mParticle.Identity.getCurrentUser()?.getMPID() === 'otherMPID');

mParticle.Identity.login({
userIdentities: { customerid: 'abc' },
});
await waitForCondition(() => {
Copy link
Collaborator

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.

Suggested change
await waitForCondition(() => {
await waitForCondition(() => mParticle.Identity.getCurrentUser()?.getMPID() === 'MPID1');

).to.equal(1);
const data = mParticle.getInstance()._Persistence.getLocalStorage();
data[testMPID].csd.should.have.property('5');
await waitForCondition(hasIdentifyReturned)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {
Copy link
Collaborator

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.

Copy link
Member Author

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 :)


mParticle.Identity.getCurrentUser().setConsentState(
falseConsentState
await waitForCondition(hasIdentifyReturned)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await waitForCondition(hasIdentifyReturned)
await waitForCondition(hasIdentifyReturned);

window.mParticle.init(apiKey, window.mParticle.config);

window.mParticle.logEvent('Blocked event');
await waitForCondition(hasIdentifyReturned)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await waitForCondition(hasIdentifyReturned)
await waitForCondition(hasIdentifyReturned);

});
}

return element;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
17.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants