Skip to content

Commit

Permalink
missing types for requestedexperimentuser (#1849)
Browse files Browse the repository at this point in the history
  • Loading branch information
danoswaltCL authored Aug 21, 2024
1 parent 1af167c commit e7b06ef
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { UpgradeLogger } from '../../../src/lib/logger/UpgradeLogger';
import { FeatureFlagService } from '../../../src/api/services/FeatureFlagService';
import { featureFlag } from '../mockData/featureFlag';
import { experimentUsers } from '../mockData/experimentUsers/index';
import { ExperimentUser } from '../../../src/api/models/ExperimentUser';
import { SEGMENT_TYPE } from '../../../../../../types/src';
import { RequestedExperimentUser } from 'src/api/controllers/validators/ExperimentUserValidator';

export default async function FeatureFlagInclusionExclusionLogic(): Promise<void> {
const featureFlagService = Container.get<FeatureFlagService>(FeatureFlagService);
Expand Down Expand Up @@ -68,7 +68,7 @@ export default async function FeatureFlagInclusionExclusionLogic(): Promise<void

// get keys for user1
let keysAssign = await featureFlagService.getKeys(
experimentUsers[0] as ExperimentUser,
experimentUsers[0] as RequestedExperimentUser,
context[0],
new UpgradeLogger()
);
Expand All @@ -77,13 +77,21 @@ export default async function FeatureFlagInclusionExclusionLogic(): Promise<void
expect(keysAssign).toEqual(expect.arrayContaining([key]));

// get keys for user2
keysAssign = await featureFlagService.getKeys(experimentUsers[1] as ExperimentUser, context[0], new UpgradeLogger());
keysAssign = await featureFlagService.getKeys(
experimentUsers[1] as RequestedExperimentUser,
context[0],
new UpgradeLogger()
);

expect(keysAssign.length).toEqual(1);
expect(keysAssign).toEqual(expect.arrayContaining([key]));

// get keys for user3
keysAssign = await featureFlagService.getKeys(experimentUsers[2] as ExperimentUser, context[0], new UpgradeLogger());
keysAssign = await featureFlagService.getKeys(
experimentUsers[2] as RequestedExperimentUser,
context[0],
new UpgradeLogger()
);

expect(keysAssign.length).toEqual(0);
}

0 comments on commit e7b06ef

Please sign in to comment.