Alerting: Fix threshold params (#111645)

* fix threshold params

* update tests
This commit is contained in:
Sonia Aguilar
2025-09-26 08:28:33 +02:00
committed by GitHub
parent 6c4be6d1ea
commit 4ea85b7feb
3 changed files with 4 additions and 3 deletions
@@ -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);