Skip to content

Commit

Permalink
handle nil in mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-shim committed Dec 11, 2024
1 parent 844817e commit 7edad7a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/mock/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,18 @@ func (t *MockWriter) GetNumRelays(ctx context.Context) (uint32, error) {

func (t *MockWriter) GetRelayURL(ctx context.Context, key uint32) (string, error) {
args := t.Called()
if args.Get(0) == nil {
return "", args.Error(1)
}
result := args.Get(0)
return result.(string), args.Error(1)
}

func (t *MockWriter) GetRelayURLs(ctx context.Context) (map[uint32]string, error) {
args := t.Called()
if args.Get(0) == nil {
return nil, args.Error(1)
}
result := args.Get(0)
if result == nil {
return nil, args.Error(1)
Expand Down

0 comments on commit 7edad7a

Please sign in to comment.