Skip to content

Commit

Permalink
Improving code coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
yasirfolio3 committed Dec 2, 2019
1 parent e4b8e2e commit 58a9b7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/config/polling_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ func NewPollingProjectConfigManager(sdkKey string, pollingMangerOptions ...Optio
}

for _, handler := range pollingProjectConfigManager.projectConfigUpdateHandlers {
if _, err := pollingProjectConfigManager.OnProjectConfigUpdate(handler); err != nil {
break
if _, err := pollingProjectConfigManager.OnProjectConfigUpdate(handler); err == nil {
// To bypass linter warnings for ignoring error
continue
}
break
}

initDatafile := pollingProjectConfigManager.initDatafile
Expand Down
13 changes: 13 additions & 0 deletions pkg/config/polling_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,16 @@ func TestDatafileTemplate(t *testing.T) {

assert.Equal(t, datafileTemplate, configManager.datafileURLTemplate)
}

func TestNotificationHandlers(t *testing.T) {

projectConfigUpdateCallback := func(notification notification.ProjectConfigUpdateNotification) {
}

sdkKey := "test_sdk_key"
exeCtx := utils.NewCancelableExecutionCtx()
configManager := NewPollingProjectConfigManager(sdkKey, WithNotificationHandlers(projectConfigUpdateCallback))
configManager.Start(sdkKey, exeCtx)

assert.Equal(t, len(configManager.projectConfigUpdateHandlers), 1)
}

0 comments on commit 58a9b7c

Please sign in to comment.