Files
magistrala/re/atom_test.go
T
Arvindh 16ba29cf4a
Property Based Tests / api-test (push) Has been cancelled
Continuous Delivery / lint-and-build (push) Has been cancelled
Deploy GitHub Pages / swagger-ui (push) Has been cancelled
CI Pipeline / Lint Proto (push) Has been cancelled
CI Pipeline / Detect Changes (push) Has been cancelled
Continuous Delivery / Build and Push Docker Images (push) Has been cancelled
CI Pipeline / lint-and-build (push) Has been cancelled
CI Pipeline / Test ${{ matrix.module }} (push) Has been cancelled
CI Pipeline / Upload Coverage (push) Has been cancelled
MG-3537 - Migrate Magistrala to ATOM for identity & authorization (#3532)
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusan <borovcanindusan1@gmail.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@absmach.eu>
Co-authored-by: Rodney Osodo <socials@rodneyosodo.com>
Co-authored-by: dusan <borovcanindusan1@gmail.com>
2026-06-26 22:06:57 +02:00

42 lines
1.1 KiB
Go

// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package re
import (
"testing"
"time"
"github.com/absmach/magistrala/pkg/schedule"
)
func TestRuleProjectionOmitsMetadataAndSchedule(t *testing.T) {
got := ruleProjection(Rule{
ID: "rule-1",
Name: "high-temp",
DomainID: "domain-1",
CreatedBy: "user-1",
Status: EnabledStatus,
Tags: []string{"smoke"},
Metadata: Metadata{"flow": "encoded-flow", "other": "value"},
InputChannel: "channel-1",
InputTopic: "messages",
Schedule: schedule.Schedule{
Time: time.Date(2026, 6, 26, 17, 0, 0, 0, time.UTC),
},
})
if _, ok := got.Attributes["metadata"]; ok {
t.Fatalf("rule metadata should not be projected to Atom attributes: %+v", got.Attributes)
}
if _, ok := got.Attributes["scheduled_at"]; ok {
t.Fatalf("rule schedule should not be projected to Atom attributes: %+v", got.Attributes)
}
if got.Attributes["input_channel"] != "channel-1" {
t.Fatalf("unexpected input_channel: %+v", got.Attributes)
}
if got.Attributes["input_topic"] != "messages" {
t.Fatalf("unexpected input_topic: %+v", got.Attributes)
}
}