diff --git a/packages/core/src/context/experiment/experiment-selectors.test.ts b/packages/core/src/context/experiment/experiment-selectors.test.ts index 93809b5d..0fcf5179 100644 --- a/packages/core/src/context/experiment/experiment-selectors.test.ts +++ b/packages/core/src/context/experiment/experiment-selectors.test.ts @@ -1,8 +1,8 @@ import { initialState, State } from '@core/context/experiment/store' import { selectCalculatedSuggestionCount, - selectCalculatedSuggestionCountFromExperiment, selectId, + selectIsConstraintActive, selectIsInitializing, selectIsMultiObjective, selectIsSuggestionCountEditable, @@ -151,4 +151,28 @@ describe('Experiment selectors', () => { } ) }) + + describe('selectIsConstraintActive', () => { + it.each([ + [['a', 'b', 'c'], true], + [['a', 'b'], true], + [['a'], false], + [[], false], + ])( + 'should return true when number of sum constraint variables > 1', + (dimensions, result) => { + const editable = selectIsConstraintActive({ + ...initialState.experiment, + constraints: [ + { + type: 'sum', + value: 100, + dimensions, + }, + ], + }) + expect(editable).toBe(result) + } + ) + }) })