Skip to content

Commit e7142e4

Browse files
committed
Fix tests with noop logger
1 parent d3a415b commit e7142e4

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

pkg/log/nooplogger.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package log
2+
3+
import "context"
4+
5+
type noop struct {
6+
}
7+
8+
func NewNoopLogger() Logger {
9+
return &noop{}
10+
}
11+
12+
func (l *noop) UnexpectedError(ctx context.Context, err error) {
13+
// nothing to do here
14+
}

pkg/server/server_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/http/httptest"
1010
"testing"
1111

12+
"github.com/friendsofgo/gopherapi/pkg/log"
1213
"github.com/friendsofgo/gopherapi/pkg/removing"
1314

1415
"github.com/friendsofgo/gopherapi/pkg/adding"
@@ -185,10 +186,10 @@ func gopherSample() *gopher.Gopher {
185186

186187
func buildServer() Server {
187188
repo := inmem.NewRepository(sample.Gophers)
188-
fS := fetching.NewService(repo)
189+
fS := fetching.NewService(repo, log.NewNoopLogger())
189190
aS := adding.NewService(repo)
190191
mS := modifying.NewService(repo)
191192
rS := removing.NewService(repo)
192193

193-
return New("test", "http://test", fS, aS, mS, rS)
194+
return New("test", fS, aS, mS, rS)
194195
}

0 commit comments

Comments
 (0)