Skip to content

Commit

Permalink
added additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xERR0R committed Jan 18, 2020
1 parent e2ad922 commit 0e5138b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package config
import (
"fmt"
"io/ioutil"
"log"
"net"
"reflect"
"strconv"
"strings"

log "github.com/sirupsen/logrus"

"gopkg.in/yaml.v2"
)

Expand Down
15 changes: 15 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"reflect"
"testing"

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)

Expand All @@ -30,6 +31,20 @@ func Test_NewConfig(t *testing.T) {
assert.Len(t, cfg.Blocking.ClientGroupsBlock, 2)
}

func Test_NewConfig_FileDoesNotExist(t *testing.T) {
err := os.Chdir("../..")
assert.NoError(t, err)

defer func() { logrus.StandardLogger().ExitFunc = nil }()

var fatal bool

logrus.StandardLogger().ExitFunc = func(int) { fatal = true }
_ = NewConfig()

assert.True(t, fatal)
}

var tests = []struct {
name string
args string
Expand Down
8 changes: 8 additions & 0 deletions resolver/parallel_best_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ func Test_Resolve_Best_Result(t *testing.T) {
fast.AssertExpectations(t)
slow.AssertExpectations(t)
}

func Test_Configuration_ParallelResolver(t *testing.T) {
sut := NewParallelBestResolver([]Resolver{&resolverMock{}, &resolverMock{}})

c := sut.Configuration()

assert.Len(t, c, 3)
}

0 comments on commit 0e5138b

Please sign in to comment.