git-lfs/lfs/batcher_test.go
2015-07-15 14:32:59 -07:00

35 lines
508 B
Go

package lfs
import (
"testing"
"github.com/github/git-lfs/vendor/_nuts/github.com/technoweenie/assert"
)
func TestBatcherSizeMet(t *testing.T) {
b := NewBatcher(2)
for i := 0; i < 4; i++ {
b.Add(&Downloadable{})
}
group := b.Next()
assert.Equal(t, 2, len(group))
group = b.Next()
assert.Equal(t, 2, len(group))
}
func TestBatcherExit(t *testing.T) {
b := NewBatcher(4)
for i := 0; i < 2; i++ {
b.Add(&Downloadable{})
}
b.Exit()
group := b.Next()
assert.Equal(t, 2, len(group))
}