Skip to content

Commit

Permalink
Tests for reader batcher
Browse files Browse the repository at this point in the history
  • Loading branch information
zix99 committed Jun 24, 2022
1 parent 12c62f1 commit b524815
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 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())
}

0 comments on commit b524815

Please sign in to comment.