Skip to content

Commit d94e85b

Browse files
Update tests to support custom storage
1 parent ad5f027 commit d94e85b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/__tests__/browserSuites/push-synchronization-retries.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export function testSynchronizationRetries(fetchMock, assert) {
135135
});
136136

137137
// initial auth
138-
fetchMock.getOnce(url(settings, `/v2/auth?s=1.3&users=${encodeURIComponent(userKey)}&users=${encodeURIComponent(otherUserKeySync)}`), function (url, opts) {
138+
fetchMock.getOnce(url(settings, `/v2/auth?s=1.3&users=${encodeURIComponent(otherUserKeySync)}&users=${encodeURIComponent(userKey)}`), function (url, opts) {
139139
if (!opts.headers['Authorization']) assert.fail('`/v2/auth` request must include `Authorization` header');
140140
assert.pass('auth success');
141141
return { status: 200, body: authPushEnabledNicolas };
@@ -144,7 +144,7 @@ export function testSynchronizationRetries(fetchMock, assert) {
144144
// initial split and memberships sync
145145
fetchMock.getOnce(url(settings, '/splitChanges?s=1.3&since=-1&rbSince=-1'), { status: 200, body: splitChangesMock1 });
146146
fetchMock.getOnce(url(settings, '/memberships/nicolas%40split.io'), { status: 200, body: membershipsNicolasMock1 });
147-
fetchMock.get({ url: url(settings, '/memberships/marcio%40split.io'), repeat: 3 }, { status: 200, body: membershipsMarcio });
147+
fetchMock.get({ url: url(settings, '/memberships/marcio%40split.io'), repeat: 4 }, { status: 200, body: membershipsMarcio });
148148

149149
// split and segment sync after SSE opened
150150
fetchMock.getOnce(url(settings, '/splitChanges?s=1.3&since=1457552620999&rbSince=100'), function () {

src/__tests__/browserSuites/ready-from-cache.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,13 +811,14 @@ export default function (fetchMock, assert) {
811811
let client = splitio.client();
812812
let manager = splitio.manager();
813813

814-
t.true(console.log.calledWithMatch('clearOnInit was set and cache was not cleared in the last 24 hours. Cleaning up cache'), 'It should log a message about cleaning up cache');
815-
816814
client.once(client.Event.SDK_READY_FROM_CACHE, () => {
817815
t.true(client.__getStatus().isReady, 'Client should emit SDK_READY_FROM_CACHE alongside SDK_READY, because clearOnInit is true');
818816
});
819817

820818
await client.ready();
819+
820+
t.true(console.log.calledWithMatch('clearOnInit was set and cache was not cleared in the last 24 hours. Cleaning up cache'), 'It should log a message about cleaning up cache');
821+
821822
t.equal(manager.names().sort().length, 36, 'active splits should be present for evaluation');
822823

823824
await splitio.destroy();

src/settings/storage/browser.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export function validateStorage(settings) {
1212
options = {},
1313
prefix,
1414
expirationDays,
15-
clearOnInit
15+
clearOnInit,
16+
storage
1617
} = { type: STORAGE_MEMORY },
1718
} = settings;
1819
let __originalType;
@@ -42,6 +43,7 @@ export function validateStorage(settings) {
4243
prefix,
4344
expirationDays,
4445
clearOnInit,
46+
storage,
4547
__originalType
4648
};
4749
}

0 commit comments

Comments
 (0)