2014-05-02 17:22:05 -05:00
|
|
|
package pebble
|
|
|
|
|
|
|
|
import (
|
2014-06-13 14:18:57 -07:00
|
|
|
"github.com/hybridgroup/gobot"
|
|
|
|
"testing"
|
2014-05-02 17:22:05 -05:00
|
|
|
)
|
|
|
|
|
2014-06-13 14:18:57 -07:00
|
|
|
var driver *PebbleDriver
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-06-13 14:18:57 -07:00
|
|
|
func init() {
|
|
|
|
driver = NewPebbleDriver(NewPebbleAdaptor("adaptor"), "pebble")
|
|
|
|
}
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-06-13 14:18:57 -07:00
|
|
|
func TestStart(t *testing.T) {
|
|
|
|
gobot.Expect(t, driver.Start(), true)
|
|
|
|
}
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-06-13 14:18:57 -07:00
|
|
|
func TestHalt(t *testing.T) {
|
|
|
|
gobot.Expect(t, driver.Halt(), true)
|
|
|
|
}
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-06-13 14:18:57 -07:00
|
|
|
func TestNotification(t *testing.T) {
|
|
|
|
driver.SendNotification("Hello")
|
|
|
|
driver.SendNotification("World")
|
2014-05-23 17:09:18 -05:00
|
|
|
|
2014-06-13 14:18:57 -07:00
|
|
|
gobot.Expect(t, driver.Messages[0], "Hello")
|
|
|
|
gobot.Expect(t, driver.PendingMessage(), "Hello")
|
|
|
|
gobot.Expect(t, driver.PendingMessage(), "World")
|
|
|
|
gobot.Expect(t, driver.PendingMessage(), "")
|
|
|
|
}
|