Skip to content

Commit

Permalink
Test selectIsConstraintActive selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Ord committed Sep 27, 2023
1 parent 46d0165 commit 32ef44e
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { initialState, State } from '@core/context/experiment/store'
import {
selectCalculatedSuggestionCount,
selectCalculatedSuggestionCountFromExperiment,
selectId,
selectIsConstraintActive,
selectIsInitializing,
selectIsMultiObjective,
selectIsSuggestionCountEditable,
Expand Down Expand Up @@ -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)
}
)
})
})

0 comments on commit 32ef44e

Please sign in to comment.