Skip to content

Commit

Permalink
rename mock file
Browse files Browse the repository at this point in the history
  • Loading branch information
ssd04 committed May 20, 2024
1 parent 5ab5c15 commit 6f04819
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions service/hyperOutportBlock/blockService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestService_Poll(t *testing.T) {
require.Nil(t, err)

nonce := uint64(10)
stream := &testscommon.GRPCServerStreamStub{}
stream := &testscommon.GRPCServerStreamMock{}
pdDuration := durationpb.New(time.Duration(100) * time.Millisecond)

wg := &sync.WaitGroup{}
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestService_Poll(t *testing.T) {
expectedErr := errors.New("expected error")

sendBlockCalled := uint32(0)
stream := &testscommon.GRPCServerStreamStub{
stream := &testscommon.GRPCServerStreamMock{
SendCalled: func(block *data.HyperOutportBlock) error {
if atomic.LoadUint32(&sendBlockCalled) <= 1 {
atomic.AddUint32(&sendBlockCalled, 1)
Expand Down Expand Up @@ -207,7 +207,7 @@ func TestService_HyperOutportBlocksStreamByHash(t *testing.T) {
}

wasCalled := uint32(0)
stream := &testscommon.GRPCServerStreamStub{
stream := &testscommon.GRPCServerStreamMock{
SendCalled: func(block *data.HyperOutportBlock) error {
atomic.AddUint32(&wasCalled, 1)
return nil
Expand Down Expand Up @@ -265,7 +265,7 @@ func TestService_HyperOutportBlocksStreamByNonce(t *testing.T) {
}

wasCalled := uint32(0)
stream := &testscommon.GRPCServerStreamStub{
stream := &testscommon.GRPCServerStreamMock{
SendCalled: func(block *data.HyperOutportBlock) error {
atomic.AddUint32(&wasCalled, 1)
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"google.golang.org/grpc/metadata"
)

// GRPCServerStreamStub -
type GRPCServerStreamStub struct {
// GRPCServerStreamMock -
type GRPCServerStreamMock struct {
SetHeaderCalled func(_ metadata.MD) error
SendHeaderCalled func(_ metadata.MD) error
SetTrailerCalled func(_ metadata.MD)
Expand All @@ -19,7 +19,7 @@ type GRPCServerStreamStub struct {
}

// Send -
func (g *GRPCServerStreamStub) Send(block *data.HyperOutportBlock) error {
func (g *GRPCServerStreamMock) Send(block *data.HyperOutportBlock) error {
if g.SendCalled != nil {
return g.SendCalled(block)
}
Expand All @@ -28,7 +28,7 @@ func (g *GRPCServerStreamStub) Send(block *data.HyperOutportBlock) error {
}

// SetHeader -
func (g *GRPCServerStreamStub) SetHeader(md metadata.MD) error {
func (g *GRPCServerStreamMock) SetHeader(md metadata.MD) error {
if g.SetHeaderCalled != nil {
return g.SetHeaderCalled(md)
}
Expand All @@ -37,7 +37,7 @@ func (g *GRPCServerStreamStub) SetHeader(md metadata.MD) error {
}

// SendHeader -
func (g *GRPCServerStreamStub) SendHeader(md metadata.MD) error {
func (g *GRPCServerStreamMock) SendHeader(md metadata.MD) error {
if g.SendHeaderCalled != nil {
return g.SendHeaderCalled(md)
}
Expand All @@ -46,14 +46,14 @@ func (g *GRPCServerStreamStub) SendHeader(md metadata.MD) error {
}

// SetTrailer -
func (g *GRPCServerStreamStub) SetTrailer(md metadata.MD) {
func (g *GRPCServerStreamMock) SetTrailer(md metadata.MD) {
if g.SetTrailerCalled != nil {
g.SetTrailerCalled(md)
}
}

// Context -
func (g *GRPCServerStreamStub) Context() context.Context {
func (g *GRPCServerStreamMock) Context() context.Context {
if g.ContextCalled != nil {
return g.ContextCalled()
}
Expand All @@ -62,7 +62,7 @@ func (g *GRPCServerStreamStub) Context() context.Context {
}

// SendMsg -
func (g *GRPCServerStreamStub) SendMsg(m any) error {
func (g *GRPCServerStreamMock) SendMsg(m any) error {
if g.SendMsgCalled != nil {
return g.SendMsgCalled(m)
}
Expand All @@ -71,7 +71,7 @@ func (g *GRPCServerStreamStub) SendMsg(m any) error {
}

// RecvMsg -
func (g *GRPCServerStreamStub) RecvMsg(m any) error {
func (g *GRPCServerStreamMock) RecvMsg(m any) error {
if g.RecvMsgCalled != nil {
return g.RecvMsgCalled(m)
}
Expand Down

0 comments on commit 6f04819

Please sign in to comment.