go-emlid/reach/client/protocol/v2/operations_test.go

34 lines
665 B
Go
Raw Normal View History

2024-07-30 14:28:39 +02:00
package v2
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 TestProtocolV2Operations(t *testing.T) {
2024-08-02 12:57:07 +02:00
proto := &Protocol{
logger: testsuite.NewLogger(t),
}
2024-07-30 14:28:39 +02:00
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)
}