Skip to content

Commit 0a9f095

Browse files
committed
FF-3282-contentul-sdk-helper rename key to "treatment" for clarity
1 parent 0ae200b commit 0a9f095

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/client/eppo-client-experiment-container.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ describe('getExperimentContainer', () => {
1919
}) as jest.Mock;
2020

2121
const controlContainer: Container = { name: 'Control Container' };
22-
const variation1Container: Container = { name: 'Variation 1 Container' };
23-
const variation2Container: Container = { name: 'Variation 2 Container' };
24-
const variation3Container: Container = { name: 'Variation 3 Container' };
22+
const treatment1Container: Container = { name: 'Treatment Variation 1 Container' };
23+
const treatment2Container: Container = { name: 'Treatment Variation 2 Container' };
24+
const treatment3Container: Container = { name: 'Treatment Variation 3 Container' };
2525

2626
let client: EppoClient;
2727
let flagExperiment: IFlagExperiment<Container>;
@@ -36,7 +36,7 @@ describe('getExperimentContainer', () => {
3636
flagExperiment = {
3737
flagKey: 'my-key',
3838
controlVariation: controlContainer,
39-
treatmentVariations: [variation1Container, variation2Container, variation3Container],
39+
treatmentVariations: [treatment1Container, treatment2Container, treatment3Container],
4040
};
4141
getStringAssignmentSpy = jest.spyOn(client, 'getStringAssignment');
4242
loggerWarnSpy = jest.spyOn(applicationLogger.logger, 'warn');
@@ -47,15 +47,15 @@ describe('getExperimentContainer', () => {
4747
loggerWarnSpy.mockRestore();
4848
});
4949

50-
it('should return the right container when a variation is assigned', async () => {
51-
jest.spyOn(client, 'getStringAssignment').mockReturnValue('variation-2');
50+
it('should return the right container when a treatment variation is assigned', async () => {
51+
jest.spyOn(client, 'getStringAssignment').mockReturnValue('treatment-2');
5252
expect(client.getExperimentContainer(flagExperiment, 'subject-key', {})).toEqual(
53-
variation2Container,
53+
treatment2Container,
5454
);
5555

56-
jest.spyOn(client, 'getStringAssignment').mockReturnValue('variation-3');
56+
jest.spyOn(client, 'getStringAssignment').mockReturnValue('treatment-3');
5757
expect(client.getExperimentContainer(flagExperiment, 'subject-key', {})).toEqual(
58-
variation3Container,
58+
treatment3Container,
5959
);
6060
});
6161

@@ -75,8 +75,8 @@ describe('getExperimentContainer', () => {
7575
expect(loggerWarnSpy).toHaveBeenCalled();
7676
});
7777

78-
it('should default to the control container if an out-of-bounds variation is assigned', async () => {
79-
jest.spyOn(client, 'getStringAssignment').mockReturnValue('variation-9');
78+
it('should default to the control container if an out-of-bounds treatment variation is assigned', async () => {
79+
jest.spyOn(client, 'getStringAssignment').mockReturnValue('treatment-9');
8080
expect(client.getExperimentContainer(flagExperiment, 'subject-key', {})).toEqual(
8181
controlContainer,
8282
);

src/client/eppo-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ export default class EppoClient {
543543
if (assignment === 'control') {
544544
return controlVariation;
545545
}
546-
if (!assignment.startsWith('variation-')) {
546+
if (!assignment.startsWith('treatment-')) {
547547
logger.warn(
548548
`Variation ${assignment} cannot be mapped to a container. Defaulting to control variation.`,
549549
);

0 commit comments

Comments
 (0)