mirror of
https://github.com/foomo/gotsrpc.git
synced 2026-04-17 19:24:30 +00:00
22 lines
521 B
Go
22 lines
521 B
Go
package service_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/foomo/gotsrpc/v2/example/context/service"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestHandler(t *testing.T) {
|
|
h := &service.Handler{}
|
|
msg := "foomo"
|
|
|
|
assert.Equal(t, "Hello foomo", h.Hello(t.Context(), msg))
|
|
|
|
require.Error(t, h.TypedError(t.Context(), msg))
|
|
require.Error(t, h.CustomError(t.Context(), msg))
|
|
require.Error(t, h.WrappedError(t.Context(), msg))
|
|
require.Error(t, h.StandardError(t.Context(), msg))
|
|
}
|