Skip to content

Commit eb45ed6

Browse files
Todd AndersonTodd Anderson
Todd Anderson
authored and
Todd Anderson
committed
chore: merge fixes
1 parent 7f3d292 commit eb45ed6

10 files changed

+28
-18
lines changed

packages/sdk/fastly/__tests__/utils/mockFeatureStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const mockFeatureStore: LDFeatureStore = {
88
upsert: jest.fn(),
99
get: jest.fn(),
1010
delete: jest.fn(),
11+
applyChanges: jest.fn(),
1112
};
1213

1314
export default mockFeatureStore;

packages/sdk/fastly/src/api/EdgeFeatureStore.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { InitMetadata } from '@launchdarkly/js-sdk-common/dist/esm/internal';
21
import type {
32
DataKind,
43
internal,

packages/shared/sdk-server/__tests__/data_sources/DataSourceUpdates.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,22 @@ type InitMetadata = internal.InitMetadata;
1313
it('passes initialization metadata to underlying feature store', () => {
1414
const metadata: InitMetadata = { environmentId: '12345' };
1515
const store = new InMemoryFeatureStore();
16-
store.init = jest.fn();
16+
store.applyChanges = jest.fn();
1717
const updates = new DataSourceUpdates(
1818
store,
1919
() => false,
2020
() => {},
2121
);
2222
updates.init({}, () => {}, metadata);
23-
expect(store.init).toHaveBeenCalledTimes(1);
24-
expect(store.init).toHaveBeenNthCalledWith(1, expect.any(Object), expect.any(Function), metadata);
23+
expect(store.applyChanges).toHaveBeenCalledTimes(1);
24+
expect(store.applyChanges).toHaveBeenNthCalledWith(
25+
1,
26+
true,
27+
expect.any(Object),
28+
expect.any(Function),
29+
metadata,
30+
undefined,
31+
);
2532
});
2633

2734
describe.each([true, false])(

packages/shared/sdk-server/__tests__/data_sources/OneShotInitializerFDv2.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { DataSourceErrorKind, LDPollingError, subsystem } from '../../src';
1+
import { subsystem } from '../../src';
22
import OneShotInitializerFDv2 from '../../src/data_sources/OneShotInitializerFDv2';
3-
import PollingProcessorFDv2 from '../../src/data_sources/PollingProcessorFDv2';
43
import Requestor from '../../src/data_sources/Requestor';
5-
import TestLogger, { LogLevel } from '../Logger';
4+
import TestLogger from '../Logger';
65

76
describe('given a one shot initializer', () => {
87
const requestor = {

packages/shared/sdk-server/__tests__/data_sources/createStreamListeners.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ describe('createStreamListeners', () => {
102102
segments,
103103
},
104104
onPutCompleteHandler,
105+
undefined,
105106
);
106107
});
107108
});

packages/shared/sdk-server/__tests__/store/PersistentStoreWrapper.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ describe.each(['caching', 'non-caching'])(
510510
},
511511
},
512512
},
513+
undefined,
513514
'selector1',
514515
);
515516

@@ -531,6 +532,7 @@ describe.each(['caching', 'non-caching'])(
531532
},
532533
},
533534
},
535+
undefined,
534536
'selector1',
535537
);
536538

@@ -549,6 +551,7 @@ describe.each(['caching', 'non-caching'])(
549551
},
550552
},
551553
},
554+
undefined,
552555
'selector1',
553556
);
554557

@@ -587,6 +590,7 @@ describe.each(['caching', 'non-caching'])(
587590
},
588591
},
589592
},
593+
undefined,
590594
'selector',
591595
);
592596
expect(callbackCount).toEqual(3);
@@ -605,6 +609,7 @@ describe.each(['caching', 'non-caching'])(
605609
},
606610
},
607611
},
612+
undefined,
608613
'selector',
609614
);
610615

@@ -620,6 +625,7 @@ describe.each(['caching', 'non-caching'])(
620625
},
621626
},
622627
},
628+
undefined,
623629
'selector',
624630
);
625631

packages/shared/sdk-server/__tests__/store/TransactionalPersistentStore.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ describe('given a non transactional store', () => {
3535
},
3636
},
3737
},
38+
undefined,
3839
'selector1',
3940
);
4041
expect(await nonTransactionalFacade.all(VersionedDataKinds.Features)).toEqual({
@@ -85,6 +86,7 @@ describe('given a non transactional store', () => {
8586
},
8687
},
8788
},
89+
undefined,
8890
'selector1',
8991
);
9092

packages/shared/sdk-server/src/LDClientImpl.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ export default class LDClientImpl implements LDClient {
232232
this._config.streamInitialReconnectDelay,
233233
)
234234
: new PollingProcessor(
235-
config,
236235
new Requestor(config, this._platform.requests, baseHeaders),
236+
config.pollInterval,
237237
dataSourceUpdates,
238+
config.logger,
238239
() => this._initSuccess(),
239240
(e) => this._dataSourceErrorHandler(e),
240241
);

packages/shared/sdk-server/src/data_sources/PollingProcessor.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
} from '@launchdarkly/js-sdk-common';
1111

1212
import { LDDataSourceUpdates } from '../api/subsystems';
13-
import Configuration from '../options/Configuration';
1413
import { deserializePoll } from '../store';
1514
import VersionedDataKinds from '../store/VersionedDataKinds';
1615
import Requestor from './Requestor';
@@ -25,22 +24,16 @@ const { initMetadataFromHeaders } = internal;
2524
export default class PollingProcessor implements subsystem.LDStreamProcessor {
2625
private _stopped = false;
2726

28-
private _logger?: LDLogger;
29-
30-
private _pollInterval: number;
31-
3227
private _timeoutHandle: any;
3328

3429
constructor(
35-
config: Configuration,
3630
private readonly _requestor: Requestor,
31+
private readonly _pollInterval: number,
3732
private readonly _featureStore: LDDataSourceUpdates,
33+
private readonly _logger?: LDLogger,
3834
private readonly _initSuccessHandler: VoidFunction = () => {},
3935
private readonly _errorHandler?: PollingErrorHandler,
40-
) {
41-
this._logger = config.logger;
42-
this._pollInterval = config.pollInterval;
43-
}
36+
) {}
4437

4538
private _poll() {
4639
if (this._stopped) {

packages/shared/sdk-server/src/store/PersistentDataStoreWrapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { internal } from '@launchdarkly/js-sdk-common';
2+
23
import {
34
DataKind,
45
PersistentDataStore,

0 commit comments

Comments
 (0)