-
Notifications
You must be signed in to change notification settings - Fork 44
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
refactor: Remove usages of Persistence First/Last Seen Times #876
base: refactor/SQDSDKS-6347-migrate-persistence-to-store
Are you sure you want to change the base?
refactor: Remove usages of Persistence First/Last Seen Times #876
Conversation
expect( | ||
mParticle.getInstance()._Store.getFirstSeenTime('current') | ||
).to.equal(null); |
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.
Can you try the following? Comment out sid
and les
from the cookies above (line 3095-3096 in this commit)
Does the test in 3115 fail?
I think it would. Because normally init
will call identify
, and the reason it is not calling it here, and you have to manually call it below this line, is because there is an sid
, and/or les
. If you step through, I think it will skip the identify
call because of that.
If the above is in fact the case, we should add a comment above mParticle.init
to explain why it isn't called, to help future developers out.
store.persistenceData['previous-set-mpid'] = { | ||
fst: 100 | ||
} |
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.
is there a reason you are setting fst for previous-set-mpid
this way directly on store.persistenceData
instead of how you are setting it for current-mpid
and previous-mpid
below?
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.
This is so we can test the possibility of the persistenceData
having an existing value, whereas the other tests cases are going through the setters. Perhaps I can move the previous-set-mpid
tests higher up so that it's in context?
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.
that sounds fine to me
test/src/tests-store.ts
Outdated
@@ -1147,6 +1166,29 @@ describe('Store', () => { | |||
expect(fromPersistence[testMPID].lst).to.be.ok; | |||
expect(fromPersistence[testMPID].lst).to.equal(54321); | |||
}); | |||
|
|||
it('returns current time for the current user', () => { |
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.
it('returns current time for the current user', () => { | |
it('returns current time for lastSeenTime for the current user', () => { |
test/src/tests-store.ts
Outdated
previous: {}, | ||
cu: 'current', |
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.
This applies to all the tests you are changing. (And future updates).
I'd say instead of giving the sample MPIDs here previous
and current
, we shold call it PREVIOUS_MPID
/previous_mpid
and CURRENT_MPID
/current_mpid
. This maes it more clear to someone who is reading this code that the key is an MPID
.
test/src/tests-store.ts
Outdated
|
||
done(); | ||
}); | ||
|
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.
Quality Gate passedIssues Measures |
@@ -3110,7 +3110,13 @@ describe('identity', function() { | |||
setCookie(workspaceCookieName, cookies, true); | |||
mParticle.config.useCookieStorage = true; | |||
|
|||
mParticle.init(apiKey, mParticle.config); | |||
|
|||
// As part of init, there is a call to Identity.Identify. However, in this test case, |
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.
👍
Instructions
development
Summary
Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)