1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-09 19:29:27 +08:00
hybridgroup.gobot/drivers/ble/device_information_driver_test.go
2024-02-04 18:50:43 +01:00

45 lines
1.2 KiB
Go

package ble
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"gobot.io/x/gobot/v2"
"gobot.io/x/gobot/v2/drivers/ble/testutil"
)
var _ gobot.Driver = (*DeviceInformationDriver)(nil)
func TestNewDeviceInformationDriver(t *testing.T) {
d := NewDeviceInformationDriver(testutil.NewBleTestAdaptor())
assert.True(t, strings.HasPrefix(d.Name(), "DeviceInformation"))
assert.NotNil(t, d.Eventer)
}
func TestDeviceInformationGetModelNumber(t *testing.T) {
d := NewDeviceInformationDriver(testutil.NewBleTestAdaptor())
assert.Equal(t, "2a24", d.GetModelNumber())
}
func TestDeviceInformationGetFirmwareRevision(t *testing.T) {
d := NewDeviceInformationDriver(testutil.NewBleTestAdaptor())
assert.Equal(t, "2a26", d.GetFirmwareRevision())
}
func TestDeviceInformationGetHardwareRevision(t *testing.T) {
d := NewDeviceInformationDriver(testutil.NewBleTestAdaptor())
assert.Equal(t, "2a27", d.GetHardwareRevision())
}
func TestDeviceInformationGetManufacturerName(t *testing.T) {
d := NewDeviceInformationDriver(testutil.NewBleTestAdaptor())
assert.Equal(t, "2a29", d.GetManufacturerName())
}
func TestDeviceInformationGetPnPId(t *testing.T) {
d := NewDeviceInformationDriver(testutil.NewBleTestAdaptor())
assert.Equal(t, "2a50", d.GetPnPId())
}