diff options
author | znerol <lo+github@znerol.ch> | 2018-02-01 19:17:52 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2018-02-01 19:17:52 +0300 |
commit | a99e0ef3f6c0f6637c4582c03cbd66a038022c46 (patch) | |
tree | 3daa48c7e2fa3e3ba4dbf6ae1547da211327c0fa /tests/javascript | |
parent | 339450a1e49ca3aebfe2824aa5f0153360101cd0 (diff) |
Add a method to de-assign a user id (#12141)
* Add a method to de-assign a user id
* Fix missing semicolon
* Tests: First examine tracker visitor id, then write cookie, then test visitor id value from cookie
* Fix number of expected assertions
* Rename method to de-assign the user id
* Regenerate minified piwik.js
* Tests: Verify userid after resetting it, fix number of expected assertions
* Add changelog entry
* Fix copy paste accident in tests
* Well, let's be consistent with surrounding code
Diffstat (limited to 'tests/javascript')
-rw-r--r-- | tests/javascript/index.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index e4897353e3..58022cadb0 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -2104,7 +2104,7 @@ function PiwikTest() { }); test("API methods", function() { - expect(89); + expect(90); equal( typeof Piwik.addPlugin, 'function', 'addPlugin' ); equal( typeof Piwik.addPlugin, 'function', 'addTracker' ); @@ -2131,6 +2131,7 @@ function PiwikTest() { equal( typeof tracker.getCurrentUrl, 'function', 'getCurrentUrl' ); equal( typeof tracker.getRequest, 'function', 'getRequest' ); equal( typeof tracker.addPlugin, 'function', 'addPlugin' ); + equal( typeof tracker.resetUserId, 'function', 'resetUserId' ); equal( typeof tracker.setUserId, 'function', 'setUserId' ); equal( typeof tracker.setSiteId, 'function', 'setSiteId' ); equal( typeof tracker.setCustomData, 'function', 'setCustomData' ); @@ -3104,7 +3105,7 @@ function PiwikTest() { } test("User ID and Visitor UUID", function() { - expect(23); + expect(26); deleteCookies(); var userIdString = 'userid@mydomain.org'; @@ -3170,12 +3171,13 @@ function PiwikTest() { // Verify that when resetting the User ID, it also changes the Visitor ID - tracker.setUserId(false); - ok(getVisitorIdFromCookie(tracker).length == 16, "after setting empty user id, visitor ID from cookie should still be 16 chars, got: " + getVisitorIdFromCookie(tracker)); - equal(getVisitorIdFromCookie(tracker), visitorId, "after setting empty user id, visitor ID from cookie should be the same as previously ("+ visitorId +")"); + tracker.resetUserId(); + equal(tracker.getUserId(), '', "after reset, user ID is set to empty string"); + ok(tracker.getVisitorId().length == 16, "after resetting user id, visitor ID should still be 16 chars, got: " + tracker.getVisitorId()); + notEqual(tracker.getVisitorId(), visitorId, "after resetting user id, visitor ID should be different ("+ tracker.getVisitorId() +")"); tracker.trackPageView("Track some data to write the cookies..."); - // Currently it does not work to setUserId(false) -// notEqual(getVisitorIdFromCookie(tracker), visitorId, "after setting empty user id, visitor ID from cookie should different ("+ visitorId +")"); + ok(getVisitorIdFromCookie(tracker).length == 16, "after resetting user id, visitor ID from cookie should still be 16 chars, got: " + getVisitorIdFromCookie(tracker)); + notEqual(getVisitorIdFromCookie(tracker), visitorId, "after resetting user id, visitor ID from cookie should be different ("+ getVisitorIdFromCookie(tracker) +")"); }); |