Skip to content

Commit ec15d2c

Browse files
fix: update import path for LOG_PREFIX constant in Redis storage
1 parent 9801bb9 commit ec15d2c

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

src/readiness/__tests__/readinessManager.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ import { EventEmitter } from '../../utils/MinEvents';
33
import { IReadinessManager } from '../types';
44
import { SDK_READY, SDK_UPDATE, SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED, SDK_READY_FROM_CACHE, SDK_SPLITS_CACHE_LOADED, SDK_READY_TIMED_OUT } from '../constants';
55
import { ISettings } from '../../types';
6-
import { STORAGE_LOCALSTORAGE } from '../../utils/constants';
76

87
const settings = {
98
startup: {
109
readyTimeout: 0,
11-
},
12-
storage: {
13-
type: STORAGE_LOCALSTORAGE
1410
}
1511
} as unknown as ISettings;
1612

src/storages/inLocalStorage/__tests__/validateCache.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe.each(storages)('validateCache', (storage) => {
4747
test('if there is cache and it must not be cleared, it should return true', async () => {
4848
storage.setItem(keys.buildSplitsTillKey(), '1');
4949
storage.setItem(keys.buildHashKey(), FULL_SETTINGS_HASH);
50+
await storage.save && storage.save();
5051

5152
expect(await validateCache({}, storage, fullSettings, keys, splits, rbSegments, segments, largeSegments)).toBe(true);
5253

@@ -66,6 +67,7 @@ describe.each(storages)('validateCache', (storage) => {
6667
storage.setItem(keys.buildSplitsTillKey(), '1');
6768
storage.setItem(keys.buildHashKey(), FULL_SETTINGS_HASH);
6869
storage.setItem(keys.buildLastUpdatedKey(), Date.now() - 1000 * 60 * 60 * 24 * 2 + ''); // 2 days ago
70+
await storage.save && storage.save();
6971

7072
expect(await validateCache({ expirationDays: 1 }, storage, fullSettings, keys, splits, rbSegments, segments, largeSegments)).toBe(false);
7173

@@ -83,6 +85,7 @@ describe.each(storages)('validateCache', (storage) => {
8385
test('if there is cache and its hash has changed, it should clear cache and return false', async () => {
8486
storage.setItem(keys.buildSplitsTillKey(), '1');
8587
storage.setItem(keys.buildHashKey(), FULL_SETTINGS_HASH);
88+
await storage.save && storage.save();
8689

8790
expect(await validateCache({}, storage, { ...fullSettings, core: { ...fullSettings.core, authorizationKey: 'another-sdk-key' } }, keys, splits, rbSegments, segments, largeSegments)).toBe(false);
8891

@@ -99,8 +102,10 @@ describe.each(storages)('validateCache', (storage) => {
99102

100103
test('if there is cache and clearOnInit is true, it should clear cache and return false', async () => {
101104
// Older cache version (without last clear)
105+
storage.removeItem(keys.buildLastClear());
102106
storage.setItem(keys.buildSplitsTillKey(), '1');
103107
storage.setItem(keys.buildHashKey(), FULL_SETTINGS_HASH);
108+
await storage.save && storage.save();
104109

105110
expect(await validateCache({ clearOnInit: true }, storage, fullSettings, keys, splits, rbSegments, segments, largeSegments)).toBe(false);
106111

src/storages/inRedis/SegmentsCacheInRedis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ILogger } from '../../logger/types';
22
import { isNaNNumber } from '../../utils/lang';
3-
import { LOG_PREFIX } from '../inLocalStorage/constants';
3+
import { LOG_PREFIX } from './constants';
44
import { KeyBuilderSS } from '../KeyBuilderSS';
55
import { ISegmentsCacheAsync } from '../types';
66
import type { RedisAdapter } from './RedisAdapter';

types/splitio.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,8 +1335,6 @@ declare namespace SplitIO {
13351335
/**
13361336
* Defines the factory function to instantiate the storage. If not provided, the default in-memory storage is used.
13371337
*
1338-
* NOTE: Currently, there is no persistent storage option available for the React Native SDK; only `InLocalStorage` for the Browser SDK.
1339-
*
13401338
* Example:
13411339
* ```
13421340
* SplitFactory({

0 commit comments

Comments
 (0)