diff --git a/pkg/extractor/batchers/readerBatcher_test.go b/pkg/extractor/batchers/readerBatcher_test.go new file mode 100644 index 0000000..25908d5 --- /dev/null +++ b/pkg/extractor/batchers/readerBatcher_test.go @@ -0,0 +1,21 @@ +package batchers + +import ( + "io/ioutil" + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestOpenReaderToChan(t *testing.T) { + r := ioutil.NopCloser(strings.NewReader("Hello\nthere\nbob")) + b := OpenReaderToChan("src", r, 1) + + b1 := <-b.BatchChan() + assert.Equal(t, "src", b1.Source) + assert.Equal(t, "Hello", string(b1.Batch[0])) + assert.Equal(t, uint64(1), b1.BatchStart) + + assert.Equal(t, 1, b.ActiveFileCount()) +}