Skip to content

Commit 9648bce

Browse files
committed
test: updated test content
1 parent 2679ab9 commit 9648bce

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

test/jest/foregroundTimeTracker.spec.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ describe('ForegroundTimeTracker', () => {
494494
});
495495
});
496496

497-
describe('#noTargeting', () => {
497+
describe('#privacy flags', () => {
498498
const workspaceToken = 'abcdef';
499499
const tosKey = `mprtcl-tos-${workspaceToken}`;
500500
let mockMPInstance: IMParticleWebSDKInstance;
@@ -532,29 +532,25 @@ describe('ForegroundTimeTracker', () => {
532532
localStorage.clear();
533533
});
534534

535-
it('should initialize timer when noTargeting is default (false)', () => {
535+
it('should track time on site when noTargeting is default (false)', () => {
536536
store.processConfig({ workspaceToken } as SDKInitConfig);
537537
expect(mockMPInstance._timeOnSiteTimer).toBeDefined();
538-
if (mockMPInstance._timeOnSiteTimer) {
539-
jest.advanceTimersByTime(1000);
540-
mockMPInstance._timeOnSiteTimer.getTimeInForeground();
541-
}
538+
jest.advanceTimersByTime(1000);
539+
mockMPInstance._timeOnSiteTimer.getTimeInForeground();
542540
expect(localStorage.getItem(tosKey)).not.toBeNull();
543541
});
544542

545-
it('should NOT initialize timer when noTargeting is true', () => {
543+
it('should NOT track time on site when noTargeting is true', () => {
546544
store.processConfig({ workspaceToken, noTargeting: true } as SDKInitConfig);
547545
expect(mockMPInstance._timeOnSiteTimer).toBeUndefined();
548546
expect(localStorage.getItem(tosKey)).toBeNull();
549547
});
550548

551-
it('should initialize timer when noTargeting is false', () => {
549+
it('should track time on site when noTargeting is false', () => {
552550
store.processConfig({ workspaceToken, noTargeting: false } as SDKInitConfig);
553551
expect(mockMPInstance._timeOnSiteTimer).toBeDefined();
554-
if (mockMPInstance._timeOnSiteTimer) {
555-
jest.advanceTimersByTime(1000);
556-
mockMPInstance._timeOnSiteTimer.getTimeInForeground();
557-
}
552+
jest.advanceTimersByTime(1000);
553+
mockMPInstance._timeOnSiteTimer.getTimeInForeground();
558554
expect(localStorage.getItem(tosKey)).not.toBeNull();
559555
});
560556
});

0 commit comments

Comments
 (0)