fix: add type field to condition test objects
The processMonitorConditions function expects conditions with type: 'expression' field. Fixed test cases to use correct format.
This commit is contained in:
parent
8b145d2522
commit
11f451d7f2
@ -164,6 +164,7 @@ describe("MqttMonitorType", {
|
|||||||
test("check() sets status to UP when message condition matches (contains)", async () => {
|
test("check() sets status to UP when message condition matches (contains)", async () => {
|
||||||
const conditions = JSON.stringify([
|
const conditions = JSON.stringify([
|
||||||
{
|
{
|
||||||
|
type: "expression",
|
||||||
variable: "message",
|
variable: "message",
|
||||||
operator: "contains",
|
operator: "contains",
|
||||||
value: "KEYWORD"
|
value: "KEYWORD"
|
||||||
@ -177,6 +178,7 @@ describe("MqttMonitorType", {
|
|||||||
test("check() sets status to UP when topic condition matches (equals)", async () => {
|
test("check() sets status to UP when topic condition matches (equals)", async () => {
|
||||||
const conditions = JSON.stringify([
|
const conditions = JSON.stringify([
|
||||||
{
|
{
|
||||||
|
type: "expression",
|
||||||
variable: "topic",
|
variable: "topic",
|
||||||
operator: "equals",
|
operator: "equals",
|
||||||
value: "sensors/temp"
|
value: "sensors/temp"
|
||||||
@ -189,6 +191,7 @@ describe("MqttMonitorType", {
|
|||||||
test("check() rejects when message condition does not match", async () => {
|
test("check() rejects when message condition does not match", async () => {
|
||||||
const conditions = JSON.stringify([
|
const conditions = JSON.stringify([
|
||||||
{
|
{
|
||||||
|
type: "expression",
|
||||||
variable: "message",
|
variable: "message",
|
||||||
operator: "contains",
|
operator: "contains",
|
||||||
value: "EXPECTED"
|
value: "EXPECTED"
|
||||||
@ -203,11 +206,13 @@ describe("MqttMonitorType", {
|
|||||||
test("check() sets status to UP with multiple conditions (AND)", async () => {
|
test("check() sets status to UP with multiple conditions (AND)", async () => {
|
||||||
const conditions = JSON.stringify([
|
const conditions = JSON.stringify([
|
||||||
{
|
{
|
||||||
|
type: "expression",
|
||||||
variable: "topic",
|
variable: "topic",
|
||||||
operator: "equals",
|
operator: "equals",
|
||||||
value: "test"
|
value: "test"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
type: "expression",
|
||||||
variable: "message",
|
variable: "message",
|
||||||
operator: "contains",
|
operator: "contains",
|
||||||
value: "success",
|
value: "success",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user