Skip to content

Commit

Permalink
rearrange parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
aarsilv committed Jun 26, 2024
1 parent 0340dec commit 6c938fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/client/eppo-client-with-bandits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('EppoClient Bandits E2E test', () => {
});

beforeEach(() => {
client = new EppoClient(flagStore, undefined, false, banditFlagStore, banditModelStore);
client = new EppoClient(flagStore, banditFlagStore, banditModelStore, undefined, false);
client.setIsGracefulFailureMode(false);
client.setAssignmentLogger({ logAssignment: mockLogAssignment });
client.setBanditLogger({ logBanditAction: mockLogBanditAction });
Expand Down
10 changes: 5 additions & 5 deletions src/client/eppo-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ describe('EppoClient E2E test', () => {
it.each(readTestData<IAssignmentTestCase>(ASSIGNMENT_TEST_DATA_DIR))(
'test variation assignment splits',
async ({ flag, variationType, defaultValue, subjects }: IAssignmentTestCase) => {
const client = new EppoClient(storage, undefined, true);
const client = new EppoClient(storage, undefined, undefined, undefined, true);
client.setIsGracefulFailureMode(false);

const typeAssignmentFunctions = {
Expand Down Expand Up @@ -622,7 +622,7 @@ describe('EppoClient E2E test', () => {
});

it('Fetches initial configuration with parameters in constructor', async () => {
client = new EppoClient(thisFlagStorage, requestConfiguration);
client = new EppoClient(thisFlagStorage, undefined, undefined, requestConfiguration);
client.setIsGracefulFailureMode(false);
// no configuration loaded
let variation = client.getNumericAssignment(flagKey, subject, {}, 123.4);
Expand Down Expand Up @@ -653,7 +653,7 @@ describe('EppoClient E2E test', () => {
}
}

client = new EppoClient(new MockStore(), requestConfiguration);
client = new EppoClient(new MockStore(), undefined, undefined, requestConfiguration);
client.setIsGracefulFailureMode(false);
// no configuration loaded
let variation = client.getNumericAssignment(flagKey, subject, {}, 0.0);
Expand Down Expand Up @@ -695,7 +695,7 @@ describe('EppoClient E2E test', () => {
...requestConfiguration,
pollAfterSuccessfulInitialization,
};
client = new EppoClient(thisFlagStorage, requestConfiguration);
client = new EppoClient(thisFlagStorage, undefined, undefined, requestConfiguration);
client.setIsGracefulFailureMode(false);
// no configuration loaded
let variation = client.getNumericAssignment(flagKey, subject, {}, 0.0);
Expand Down Expand Up @@ -760,7 +760,7 @@ describe('EppoClient E2E test', () => {
throwOnFailedInitialization,
pollAfterFailedInitialization,
};
client = new EppoClient(thisFlagStorage, requestConfiguration);
client = new EppoClient(thisFlagStorage, undefined, undefined, requestConfiguration);
client.setIsGracefulFailureMode(false);
// no configuration loaded
expect(client.getNumericAssignment(flagKey, subject, {}, 0.0)).toBe(0.0);
Expand Down
5 changes: 2 additions & 3 deletions src/client/eppo-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,10 @@ export default class EppoClient implements IEppoClient {

constructor(
private flagConfigurationStore: IConfigurationStore<Flag | ObfuscatedFlag>,
private configurationRequestParameters?: FlagConfigurationRequestParameters,
private isObfuscated = false,
// Parameter order is for backwards compatibility, and thus related items are not grouped
private banditFlagConfigurationStore?: IConfigurationStore<BanditFlagAssociation[]>,
private banditModelConfigurationStore?: IConfigurationStore<BanditParameters>,
private configurationRequestParameters?: FlagConfigurationRequestParameters,
private isObfuscated = false,
) {}

public setConfigurationRequestParameters(
Expand Down

0 comments on commit 6c938fa

Please sign in to comment.