Skip to content

Commit

Permalink
Build out more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Sep 4, 2019
1 parent abe3e40 commit 5cef501
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions processor/workers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,34 @@ func TestProcessMatchesFuzzyTwo(t *testing.T) {
t.Error("Score should be 2 got", res.Score)
}
}

func TestFileReaderWorker(t *testing.T) {
ResultLimit = 100

input := make(chan *FileJob, 10)
output := make(chan *FileJob, 10)

input <- &FileJob{
Filename: "workers.go",
Extension: "go",
Location: "./workers.go",
Content: nil,
Bytes: 0,
Hash: nil,
Binary: false,
Score: 0,
Locations: nil,
}
close(input)

FileReaderWorker(input, output)

out := []*FileJob{}
for o := range output {
out = append(out, o)
}

if len(out) == 0 {
t.Error("Expected at least one")
}
}

0 comments on commit 5cef501

Please sign in to comment.