Skip to content

Commit 74da556

Browse files
committed
added test for nth key
1 parent 2ff5b8b commit 74da556

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

amplitude.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ Amplitude.prototype.init = function(apiKey, opt_userId, opt_config, callback) {
221221
domain: this.options.domain
222222
});
223223
this.options.domain = Cookie.options().domain;
224-
225224
this._upgradeStoredData();
226225
this._loadStoredData();
227226

src/amplitude.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ Amplitude.prototype.init = function(apiKey, opt_userId, opt_config, callback) {
115115
domain: this.options.domain
116116
});
117117
this.options.domain = Cookie.options().domain;
118-
119118
this._upgradeStoredData();
120119
this._loadStoredData();
121120

test/localstorage.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ describe('Localstorage', function() {
9191
assert.equal(cookieStorage.getItem('key-a'), longString);
9292
assert.isNull(cookieStorage.getItem('key-b'));
9393
});
94+
95+
it('should fetch the nth key', function() {
96+
cookieStorage.setItem('key-a', 'value-a');
97+
cookieStorage.setItem('key-b', 'value-b');
98+
99+
assert.isNull(cookieStorage.key(5));
100+
assert.equal(cookieStorage.key(1), 'key-b');
101+
});
94102
});
95103

96104
describe('upgrade', function() {

0 commit comments

Comments
 (0)