forked from evcc-io/evcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallbe_test.go
50 lines (39 loc) · 905 Bytes
/
wallbe_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package charger
import (
"testing"
"github.com/evcc-io/evcc/api"
)
func TestWallbeLegacy(t *testing.T) {
wbc, err := NewWallbeFromConfig(map[string]interface{}{"legacy": true})
if err != nil {
t.Error(err)
}
wb, ok := wbc.(*Wallbe)
if !ok {
t.Error("unexpected type")
}
if wb.factor != 1 {
t.Errorf("invalid factor: %d", wb.factor)
}
if _, ok = wbc.(api.ChargeTimer); !ok {
t.Error("missing charge timer api")
}
if _, ok = wbc.(api.Diagnosis); !ok {
t.Error("missing diagnosis api")
}
}
func TestWallbeEx(t *testing.T) {
wbc, err := NewWallbeFromConfig(map[string]interface{}{"legacy": false})
if err != nil {
t.Error(err)
}
if _, ok := wbc.(api.ChargerEx); !ok {
t.Error("missing ChargerEx api")
}
if _, ok := wbc.(api.ChargeTimer); !ok {
t.Error("missing ChargeTimer api")
}
if _, ok := wbc.(api.Diagnosis); !ok {
t.Error("missing Diagnosis api")
}
}