Skip to content

Commit

Permalink
fix: use noopListener
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Dec 19, 2023
1 parent c99a893 commit d4a5c32
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1180,17 +1180,11 @@ func TestGetVariantWithFallbackVariantWhenFeatureDisabled(t *testing.T) {
Segments: []api.Segment{},
})

mockListener := &MockedListener{}
mockListener.On("OnReady").Return()
mockListener.On("OnRegistered", mock.AnythingOfType("ClientData"))
mockListener.On("OnCount", feature, false).Return()
mockListener.On("OnError").Return()

client, err := NewClient(
WithUrl(mockerServer),
WithAppName(mockAppName),
WithInstanceId(mockInstanceId),
WithListener(mockListener),
WithListener(&NoopListener{}),
)

assert.NoError(err)
Expand Down Expand Up @@ -1255,17 +1249,11 @@ func TestGetVariantWithFallbackVariantWhenFeatureEnabledButNoVariants(t *testing
Segments: []api.Segment{},
})

mockListener := &MockedListener{}
mockListener.On("OnReady").Return()
mockListener.On("OnRegistered", mock.AnythingOfType("ClientData"))
mockListener.On("OnCount", feature, true).Return()
mockListener.On("OnError").Return()

client, err := NewClient(
WithUrl(mockerServer),
WithAppName(mockAppName),
WithInstanceId(mockInstanceId),
WithListener(mockListener),
WithListener(&NoopListener{}),
)

assert.NoError(err)
Expand Down Expand Up @@ -1318,17 +1306,11 @@ func TestGetVariantWithFallbackVariantWhenFeatureDoesntExist(t *testing.T) {
Segments: []api.Segment{},
})

mockListener := &MockedListener{}
mockListener.On("OnReady").Return()
mockListener.On("OnRegistered", mock.AnythingOfType("ClientData"))
mockListener.On("OnCount", feature, false).Return()
mockListener.On("OnError").Return()

client, err := NewClient(
WithUrl(mockerServer),
WithAppName(mockAppName),
WithInstanceId(mockInstanceId),
WithListener(mockListener),
WithListener(&NoopListener{}),
)

assert.NoError(err)
Expand Down

0 comments on commit d4a5c32

Please sign in to comment.