evcc-io/core/site_api_test.go
andig 4465100a65
Config UI: allow disabling devices (#29455)
Co-authored-by: Michael Geers <michael@geers.tv>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: andig <184815+andig@users.noreply.github.com>
2026-08-11 13:24:40 +00:00

22 lines
524 B
Go

package core
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLoadpointsNilSlots(t *testing.T) {
site := &Site{loadpoints: []*Loadpoint{new(Loadpoint), nil, new(Loadpoint)}}
lps := site.Loadpoints()
assert.Len(t, lps, 3, "disabled loadpoints must keep their slot")
// disabled slot must be untyped nil, not a typed-nil interface
assert.True(t, lps[1] == nil)
assert.NotNil(t, lps[0])
assert.NotNil(t, lps[2])
assert.Len(t, site.activeLoadpoints(), 2)
assert.True(t, site.IsConfigured())
}