chore: add MaxACPower test (#19285)
This commit is contained in:
parent
766194d0c0
commit
59d7bb54ff
2 changed files with 32 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ type maxpower struct {
|
|||
MaxACPower float64
|
||||
}
|
||||
|
||||
// var _ api.MaxACPowerGetter = (*maxpower)(nil)
|
||||
|
||||
// MaxACPowerDecorator returns the max AC power decorator
|
||||
func (m *maxpower) Decorator() func() float64 {
|
||||
if m.MaxACPower == 0 {
|
||||
|
|
|
|||
30
meter/meter_test.go
Normal file
30
meter/meter_test.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package meter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/evcc-io/evcc/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestACPower(t *testing.T) {
|
||||
m, err := NewConfigurableFromConfig(context.TODO(), map[string]any{
|
||||
"capacity": 23,
|
||||
"soc": map[string]any{
|
||||
"source": "const",
|
||||
"value": 47,
|
||||
},
|
||||
"maxacpower": 1000,
|
||||
"power": map[string]any{
|
||||
"source": "const",
|
||||
"value": 1000,
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
_, ok := m.(api.BatteryCapacity)
|
||||
assert.True(t, ok, "api.BatteryCapacity")
|
||||
_, ok = m.(api.MaxACPowerGetter)
|
||||
assert.True(t, ok, "api.MaxACPowerGetter")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue