@splitsoftware/splitio-react
Version:
A React library to easily integrate and use Split JS SDK
20 lines (15 loc) • 769 B
text/typescript
import { CONTROL_WITH_CONFIG } from '../constants';
import { getControlTreatmentsWithConfig } from '../utils';
describe('getControlTreatmentsWithConfig', () => {
it('should return an empty object if an empty array is provided', () => {
expect(Object.values(getControlTreatmentsWithConfig([])).length).toBe(0);
});
it('should return an empty object if an empty array is provided', () => {
const featureFlagNames = ['split1', 'split2'];
const treatments: SplitIO.TreatmentsWithConfig = getControlTreatmentsWithConfig(featureFlagNames);
featureFlagNames.forEach((featureFlagName) => {
expect(treatments[featureFlagName]).toBe(CONTROL_WITH_CONFIG);
});
expect(Object.keys(treatments).length).toBe(featureFlagNames.length);
});
});