32 lines
629 B
Go
32 lines
629 B
Go
|
package v1
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"testing"
|
||
|
|
||
|
"forge.cadoles.com/cadoles/go-emlid/reach/client/protocol"
|
||
|
"forge.cadoles.com/cadoles/go-emlid/reach/client/protocol/testsuite"
|
||
|
"github.com/pkg/errors"
|
||
|
)
|
||
|
|
||
|
func TestProtocolV1Operations(t *testing.T) {
|
||
|
proto := &Protocol{}
|
||
|
|
||
|
factory := func(addr string) (protocol.Operations, error) {
|
||
|
ctx := context.Background()
|
||
|
|
||
|
available, err := proto.Available(ctx, addr)
|
||
|
if err != nil {
|
||
|
return nil, errors.WithStack(err)
|
||
|
}
|
||
|
|
||
|
if !available {
|
||
|
return nil, errors.New("protocol is not available")
|
||
|
}
|
||
|
|
||
|
return proto.Operations(addr), nil
|
||
|
}
|
||
|
|
||
|
testsuite.TestOperations(t, factory)
|
||
|
}
|