Skip to content

Commit

Permalink
down to a single suspect
Browse files Browse the repository at this point in the history
  • Loading branch information
sighphyre committed Dec 8, 2023
1 parent 3c6da6c commit 43ad334
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,49 +55,49 @@ import (
// assert.True(gock.IsDone(), "there should be no more mocks")
// }

// func TestClient_WithFallbackFunc(t *testing.T) {
// assert := assert.New(t)
// defer gock.OffAll()
func TestClient_WithFallbackFunc(t *testing.T) {
assert := assert.New(t)
defer gock.OffAll()

// gock.New(mockerServer).
// Post("/client/register").
// MatchHeader("UNLEASH-APPNAME", mockAppName).
// MatchHeader("UNLEASH-INSTANCEID", mockInstanceId).
// Reply(200)
gock.New(mockerServer).
Post("/client/register").
MatchHeader("UNLEASH-APPNAME", mockAppName).
MatchHeader("UNLEASH-INSTANCEID", mockInstanceId).
Reply(200)

// gock.New(mockerServer).
// Get("/client/features").
// Reply(200).
// JSON(api.FeatureResponse{})
gock.New(mockerServer).
Get("/client/features").
Reply(200).
JSON(api.FeatureResponse{})

// feature := "does_not_exist"
feature := "does_not_exist"

// mockListener := &MockedListener{}
// mockListener.On("OnReady").Return()
// mockListener.On("OnRegistered", mock.AnythingOfType("ClientData"))
// mockListener.On("OnCount", feature, true).Return()
// mockListener.On("OnError").Return()
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),
// )
client, err := NewClient(
WithUrl(mockerServer),
WithAppName(mockAppName),
WithInstanceId(mockInstanceId),
WithListener(mockListener),
)

// assert.NoError(err)
assert.NoError(err)

// client.WaitForReady()
client.WaitForReady()

// fallback := func(f string, ctx *context.Context) bool {
// return f == feature
// }
fallback := func(f string, ctx *context.Context) bool {
return f == feature
}

// isEnabled := client.IsEnabled("does_not_exist", WithFallbackFunc(fallback))
// assert.True(isEnabled)
isEnabled := client.IsEnabled("does_not_exist", WithFallbackFunc(fallback))
assert.True(isEnabled)

// assert.True(gock.IsDone(), "there should be no more mocks")
// }
assert.True(gock.IsDone(), "there should be no more mocks")
}

func TestClient_WithResolver(t *testing.T) {
assert := assert.New(t)
Expand Down

0 comments on commit 43ad334

Please sign in to comment.