From 4451b520d388eaa7a2ec572e4730aa5f4c7cf833 Mon Sep 17 00:00:00 2001 From: Jasmina Malicevic Date: Thu, 16 Jun 2022 14:17:43 +0200 Subject: [PATCH] light client mock fix --- light/rpc/mocks/light_client.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/light/rpc/mocks/light_client.go b/light/rpc/mocks/light_client.go index 347d14707..4130c9575 100644 --- a/light/rpc/mocks/light_client.go +++ b/light/rpc/mocks/light_client.go @@ -115,3 +115,18 @@ func (_m *LightClient) VerifyLightBlockAtHeight(ctx context.Context, height int6 return r0, r1 } + +type NewLightClientT interface { + mock.TestingT + Cleanup(func()) +} + +// NewLightClient creates a new instance of LightClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewLightClient(t NewLightClientT) *LightClient { + mock := &LightClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}