Alerting: Fix threshold params (#111645)
* fix threshold params * update tests
This commit is contained in:
@@ -72,7 +72,6 @@ exports[`thresholdReducer should update Threshold Type, and unloadEvaluator para
|
||||
{
|
||||
"evaluator": {
|
||||
"params": [
|
||||
10,
|
||||
0,
|
||||
],
|
||||
"type": "lt",
|
||||
@@ -90,7 +89,6 @@ exports[`thresholdReducer should update Threshold Type, and unloadEvaluator para
|
||||
"type": "query",
|
||||
"unloadEvaluator": {
|
||||
"params": [
|
||||
10,
|
||||
0,
|
||||
],
|
||||
"type": "gt",
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('thresholdReducer', () => {
|
||||
expect(newState.conditions[0].evaluator.type).toEqual(EvalFunction.IsBelow);
|
||||
expect(newState.conditions[0].unloadEvaluator?.type).toEqual(EvalFunction.IsAbove);
|
||||
expect(onError).toHaveBeenCalledWith(undefined);
|
||||
expect(newState.conditions[0].unloadEvaluator?.params[0]).toEqual(10);
|
||||
expect(newState.conditions[0].unloadEvaluator?.params[0]).toEqual(0);
|
||||
});
|
||||
it('Should update unlooadEvaluator when checking hysteresis', () => {
|
||||
const initialState: ThresholdExpressionQuery = {
|
||||
|
||||
@@ -33,6 +33,9 @@ export const thresholdReducer = createReducer<ThresholdExpressionQuery>(
|
||||
//set new type in evaluator
|
||||
state.conditions[0].evaluator.type = typeInPayload;
|
||||
|
||||
//reset params
|
||||
state.conditions[0].evaluator.params = [0];
|
||||
|
||||
// check if hysteresis is checked
|
||||
const hsyteresisIsChecked = Boolean(state.conditions[0].unloadEvaluator);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user