24 lines
405 B
Go
24 lines
405 B
Go
package presence
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestStubGetOffline(t *testing.T) {
|
|
s := NewStub()
|
|
items, err := s.Get(context.Background(), []string{"a", "b"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(items) != 2 || items[0].Online || items[1].Online {
|
|
t.Fatalf("%+v", items)
|
|
}
|
|
}
|
|
|
|
func TestStubIsOnlineFalse(t *testing.T) {
|
|
if NewStub().IsOnline("x") {
|
|
t.Fatal("expected offline")
|
|
}
|
|
}
|