Skip to content

Commit

Permalink
fix test and linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hugowetterberg committed Feb 19, 2024
1 parent 26c6b7c commit f0b8ad1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func TestConnection_Connect_resetBody(t *testing.T) {
},
}

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {
time.Sleep(time.Millisecond * 5)
}))
defer ts.Close()
Expand Down Expand Up @@ -250,7 +250,7 @@ func TestConnection_Connect_validator(t *testing.T) {
},
}

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
ts := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {}))
defer ts.Close()

c := &sse.Client{
Expand Down Expand Up @@ -611,7 +611,7 @@ func TestConnection_reconnect(t *testing.T) {
retries := 0
c := sse.Client{
HTTPClient: ts.Client(),
OnRetry: func(err error, d time.Duration) {
OnRetry: func(_ error, _ time.Duration) {
retries++
if retries == 3 {
cancel()
Expand Down
4 changes: 2 additions & 2 deletions joe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ data: world
func TestJoe_errors(t *testing.T) {
t.Parallel()

fin, err := sse.NewFiniteReplayProvider(1, false)
fin, err := sse.NewFiniteReplayProvider(2, false)
tests.Equal(t, err, nil, "should create new FiniteReplayProvider")

j := &sse.Joe{
Expand Down Expand Up @@ -277,7 +277,7 @@ func TestJoe_errors(t *testing.T) {

err = j.Subscribe(ctx, sse.Subscription{Client: client, Topics: []string{sse.DefaultTopic}})
tests.Equal(t, err, callErr, "error not received from send")
tests.Equal(t, called, 1, "callback was called after subscribe returned")
tests.Equal(t, called, 0, "callback was called after subscribe returned")

<-done
}
Expand Down
2 changes: 1 addition & 1 deletion replay_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func NewFiniteReplayProvider(
// FiniteReplayProvider is a replay provider that replays at maximum a certain number of events.
// The events must have an ID unless the AutoIDs flag is toggled.
type FiniteReplayProvider struct {
cap int
buf []messageWithTopics
cap int
head int
tail int
autoIDs bool
Expand Down

0 comments on commit f0b8ad1

Please sign in to comment.