mirror of
https://github.com/nikdoof/hapz2m.git
synced 2026-01-30 02:18:22 +00:00
Introduce constructors for ExposeMapping
This should allow the ExposeMapping struct to be changed without constantly impacting its callers.
This commit is contained in:
@@ -148,10 +148,10 @@ func TestMappingTranslation(t *testing.T) {
|
||||
}`)
|
||||
|
||||
s := service.NewContactSensor()
|
||||
m := &ExposeMapping{exp, s.ContactSensorState.C,
|
||||
m := NewTranslatedExposeMapping(exp, s.ContactSensorState.C,
|
||||
&BoolTranslator{
|
||||
characteristic.ContactSensorStateContactDetected,
|
||||
characteristic.ContactSensorStateContactNotDetected}}
|
||||
characteristic.ContactSensorStateContactNotDetected})
|
||||
initExposeMappings(m)
|
||||
|
||||
for _, test := range []struct{ e, c any }{
|
||||
@@ -184,7 +184,7 @@ func TestMappingNumeric(t *testing.T) {
|
||||
}`)
|
||||
|
||||
s := service.NewTemperatureSensor()
|
||||
m := &ExposeMapping{exp, s.CurrentTemperature.C, nil}
|
||||
m := NewExposeMapping(exp, s.CurrentTemperature.C)
|
||||
initExposeMappings(m)
|
||||
|
||||
for _, test := range []struct {
|
||||
|
||||
Reference in New Issue
Block a user