implement econet exporter
Build and Publish / go-binaries (push) Has been skipped
Build and Publish / container-images (push) Has been skipped
Build and Publish / helm-release (push) Successful in 19s
Build and Publish / check-chart (push) Successful in 52s

This commit is contained in:
2026-07-04 17:22:31 -04:00
parent 8198e8cfee
commit b2ec72352a
44 changed files with 2226 additions and 1281 deletions
+38
View File
@@ -0,0 +1,38 @@
package econetmcp
import (
"strings"
"testing"
pb "gitea.libretechconsulting.com/rmcguire/econet-exporter/api/econet/v1alpha1"
)
func TestSummarizeDevices(t *testing.T) {
tests := []struct {
name string
devices []*pb.Device
want string // substring that must appear
}{
{"empty", nil, "No EcoNet devices found."},
{
name: "single",
devices: []*pb.Device{{
FriendlyName: "Garage",
GenericType: "heatpumpWaterHeater",
SerialNumber: "ABC123",
Mode: "heat-pump",
Setpoint: 125,
}},
want: "Garage (heatpumpWaterHeater, serial ABC123): mode=heat-pump setpoint=125",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := summarizeDevices(tt.devices)
if !strings.Contains(got, tt.want) {
t.Errorf("summarizeDevices() = %q, want substring %q", got, tt.want)
}
})
}
}