Skip to content

Commit

Permalink
Add test for getBlobsFromChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
dineshba committed Jul 13, 2020
1 parent 1583857 commit 3f90fba
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scanner/scanner_test.go
@@ -0,0 +1,24 @@
package scanner

import (
"github.com/stretchr/testify/assert"
"testing"
)

func Test_getBlobsFromChannel(t *testing.T) {
ch := make(chan []string)
go func() {
ch <- []string{
"100644 blob 351324aa7b3c66043e484c2f2c7b7f1842152f35 .gitignore",
"100644 blob 8715df9907604c8ee8fc5e377821817f84f014fa .pre-commit-hooks.yaml",
"commitSha",
}
}()
blobsInCommits := BlobsInCommits{commits: map[string][]string{}}
getBlobsFromChannel(blobsInCommits, ch)

commits := blobsInCommits.commits
assert.Len(t, commits, 2)
assert.Equal(t, []string{"commitSha"}, commits["351324aa7b3c66043e484c2f2c7b7f1842152f35 .gitignore"])
assert.Equal(t, []string{"commitSha"}, commits["8715df9907604c8ee8fc5e377821817f84f014fa .pre-commit-hooks.yaml"])
}

0 comments on commit 3f90fba

Please sign in to comment.