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.
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.
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.
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?
test/src/tests-store.ts
Outdated
| expect(fromPersistence[testMPID].lst).to.equal(54321); | ||
| }); | ||
|
|
||
| it('returns current time for the current user', () => { |
There was a problem hiding this comment.
| 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.
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(); | ||
| }); | ||
|
|
|
|
|
||
| mParticle.init(apiKey, mParticle.config); | ||
|
|
||
| // As part of init, there is a call to Identity.Identify. However, in this test case, |




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