Skip to content

Commit 07dedd7

Browse files
Polishing
1 parent 02f0235 commit 07dedd7

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/storages/inLocalStorage/MySegmentsCacheInLocal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class MySegmentsCacheInLocal extends AbstractMySegmentsCacheSync {
5151

5252
getRegisteredSegments(): string[] {
5353
const registeredSegments: string[] = [];
54-
for (let i = 0; i < this.storage.length; i++) {
54+
for (let i = 0, len = this.storage.length; i < len; i++) {
5555
const segmentName = this.keys.extractSegmentName(this.storage.key(i)!);
5656
if (segmentName) registeredSegments.push(segmentName);
5757
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { MySegmentsCacheInLocal } from '../MySegmentsCacheInLocal';
22
import { KeyBuilderCS, myLargeSegmentsKeyBuilder } from '../../KeyBuilderCS';
33
import { loggerMock } from '../../../logger/__tests__/sdkLogger.mock';
4+
import { IMySegmentsResponse } from '../../../dtos/types';
45

56
test('SEGMENT CACHE / in LocalStorage', () => {
67
const caches = [
@@ -22,11 +23,10 @@ test('SEGMENT CACHE / in LocalStorage', () => {
2223
});
2324

2425
caches.forEach(cache => {
25-
// @ts-expect-error
2626
cache.resetSegments({
2727
added: [],
2828
removed: ['mocked-segment']
29-
});
29+
} as IMySegmentsResponse);
3030

3131
expect(cache.isInSegment('mocked-segment')).toBe(false);
3232
expect(cache.getRegisteredSegments()).toEqual(['mocked-segment-2']);

src/storages/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { ISettings } from '../types';
1010
*/
1111
export interface StorageAdapter {
1212
readonly length: number;
13-
getItem(key: string): string | null;
1413
key(index: number): string | null;
14+
getItem(key: string): string | null;
1515
removeItem(key: string): void;
1616
setItem(key: string, value: string): void;
1717
}

0 commit comments

Comments
 (0)