diff --git a/client_test.go b/client_test.go index 9c1dcd7..4047061 100644 --- a/client_test.go +++ b/client_test.go @@ -223,40 +223,40 @@ func TestClient_ListFeatures(t *testing.T) { require.Equal(t, features, client.ListFeatures()) } -// func TestClientWithProjectName(t *testing.T) { -// assert := assert.New(t) -// projectName := "myProject" -// defer gock.OffAll() +func TestClientWithProjectName(t *testing.T) { + assert := assert.New(t) + projectName := "myProject" + defer gock.OffAll() -// gock.New(mockerServer). -// Post("/client/register"). -// Reply(200) + gock.New(mockerServer). + Post("/client/register"). + Reply(200) -// gock.New(mockerServer). -// Get("/client/features"). -// MatchParam("project", projectName). -// Reply(200). -// JSON(api.FeatureResponse{}) + gock.New(mockerServer). + Get("/client/features"). + MatchParam("project", projectName). + Reply(200). + JSON(api.FeatureResponse{}) -// mockListener := &MockedListener{} -// mockListener.On("OnReady").Return() -// mockListener.On("OnRegistered", mock.AnythingOfType("ClientData")) -// mockListener.On("OnError").Return() + mockListener := &MockedListener{} + mockListener.On("OnReady").Return() + mockListener.On("OnRegistered", mock.AnythingOfType("ClientData")) + mockListener.On("OnError").Return() -// client, err := NewClient( -// WithUrl(mockerServer), -// WithAppName(mockAppName), -// WithInstanceId(mockInstanceId), -// WithProjectName(projectName), -// WithListener(mockListener), -// ) + client, err := NewClient( + WithUrl(mockerServer), + WithAppName(mockAppName), + WithInstanceId(mockInstanceId), + WithProjectName(projectName), + WithListener(mockListener), + ) -// client.WaitForReady() + client.WaitForReady() -// assert.NoError(err) -// assert.Equal(client.options.projectName, projectName) -// assert.True(gock.IsDone(), "there should be no more mocks") -// } + assert.NoError(err) + assert.Equal(client.options.projectName, projectName) + assert.True(gock.IsDone(), "there should be no more mocks") +} // func TestClientWithoutProjectName(t *testing.T) { // assert := assert.New(t)