Skip to content

Commit 52866e6

Browse files
committed
remove range check from sessionPercent and update test
1 parent 0bee482 commit 52866e6

File tree

2 files changed

+2
-71
lines changed

2 files changed

+2
-71
lines changed

src/MixpanelEventForwarder.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,8 @@ var constructor = function () {
7272
forwarderSettings.recordSessionsPercent,
7373
10
7474
);
75-
if (
76-
!isNaN(sessionPercent) &&
77-
sessionPercent >= 0 &&
78-
sessionPercent <= 100
79-
) {
75+
76+
if (!isNaN(sessionPercent)) {
8077
initOptions.record_sessions_percent = sessionPercent;
8178
}
8279
}

test/src/tests.js

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -377,72 +377,6 @@ describe('Mixpanel Forwarder', function () {
377377
done();
378378
});
379379

380-
it('should validate recordSessionsPercent range (0-100)', function (done) {
381-
// Test valid upper boundary: 100
382-
window.mixpanel = new MPMock();
383-
mParticle.forwarder.init(
384-
{
385-
token: 'token123',
386-
baseUrl: API_HOST,
387-
recordSessionsPercent: '100',
388-
},
389-
reportService.cb,
390-
true
391-
);
392-
window.mixpanel.settings.should.have.property(
393-
'record_sessions_percent',
394-
100
395-
);
396-
397-
// Test valid lower boundary: 0
398-
window.mixpanel = new MPMock();
399-
mParticle.forwarder.init(
400-
{
401-
token: 'token123',
402-
baseUrl: API_HOST,
403-
recordSessionsPercent: '0',
404-
},
405-
reportService.cb,
406-
true
407-
);
408-
window.mixpanel.settings.should.have.property(
409-
'record_sessions_percent',
410-
0
411-
);
412-
413-
// Test invalid: negative
414-
window.mixpanel = new MPMock();
415-
mParticle.forwarder.init(
416-
{
417-
token: 'token123',
418-
baseUrl: API_HOST,
419-
recordSessionsPercent: '-10',
420-
},
421-
reportService.cb,
422-
true
423-
);
424-
window.mixpanel.settings.should.not.have.property(
425-
'record_sessions_percent'
426-
);
427-
428-
// Test invalid: > 100
429-
window.mixpanel = new MPMock();
430-
mParticle.forwarder.init(
431-
{
432-
token: 'token123',
433-
baseUrl: API_HOST,
434-
recordSessionsPercent: '150',
435-
},
436-
reportService.cb,
437-
true
438-
);
439-
window.mixpanel.settings.should.not.have.property(
440-
'record_sessions_percent'
441-
);
442-
443-
done();
444-
});
445-
446380
it('should ignore null and undefined values for all setting types', function (done) {
447381
window.mixpanel = new MPMock();
448382
mParticle.forwarder.init(

0 commit comments

Comments
 (0)