diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-12-06 03:30:14 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-12-06 03:30:14 +0300 |
commit | 17f16ed439e61d9fca9becdb27b034fbd3cd9e78 (patch) | |
tree | 05deca9d03eb934d63854e5ad9188f77cf7e95b4 /tests/javascript | |
parent | 2633c57395c5c5795d06ce45984e66d802e7074d (diff) |
Send bulk requests in chunks when needed (#13444)
* send bulk requests in chunks
* send requests correctly
Diffstat (limited to 'tests/javascript')
-rw-r--r-- | tests/javascript/index.php | 11 | ||||
-rw-r--r-- | tests/javascript/matomotest.js | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 287e781cc9..0846639263 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -2261,7 +2261,7 @@ function PiwikTest() { }); test("Tracker is_a functions", function() { - expect(22); + expect(29); var tracker = Piwik.getTracker(); @@ -2290,6 +2290,15 @@ function PiwikTest() { ok( !tracker.hook.test._isString(window), 'isString(window)' ); ok( !tracker.hook.test._isString(function () { }), 'isString(function)' ); ok( tracker.hook.test._isString(new String), 'isString(String)' ); // String is a string + + var arrayChunk = tracker.hook.test._arrayChunk; + deepEqual([[]], arrayChunk([]), 'empty array, no chunk size' ); + deepEqual([[]], arrayChunk([], 50), 'empty array, with chunk size' ); + deepEqual([[5]], arrayChunk([5], 50), 'one item, much larger chunk size' ); + deepEqual([[5,10,15,20,25]], arrayChunk([5,10,15,20,25]), 'multiple items, no chunk size' ); + deepEqual([[5,10,15,20,25]], arrayChunk([5,10,15,20,25], 50), 'multiple items, much larger chunk size' ); + deepEqual([[5,10],[15,20],[25]], arrayChunk([5,10,15,20,25], 2), 'multiple items, small chunk size' ); + deepEqual([[5,10,15,20,25]], arrayChunk([5,10,15,20,25], 5), 'multiple items, equals chunk size' ); }); test("Default visitorId should be equal across Trackers", function() { diff --git a/tests/javascript/matomotest.js b/tests/javascript/matomotest.js index 514d1c5c8c..5487f39048 100644 --- a/tests/javascript/matomotest.js +++ b/tests/javascript/matomotest.js @@ -43,6 +43,7 @@ Piwik.addPlugin('testPlugin', { '_isSameCrossDomainDevice: isSameCrossDomainDevice,' + '_replaceHrefForCrossDomainLink: replaceHrefForCrossDomainLink,' + '_isLinkToDifferentDomainButSamePiwikWebsite: isLinkToDifferentDomainButSamePiwikWebsite,' + + '_arrayChunk : arrayChunk,' + '_urlFixup : urlFixup,' + '_domainFixup : domainFixup,' + '_titleFixup : titleFixup,' + |