Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
tests: Increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
blackandred committed Mar 6, 2022
1 parent f25222b commit 0d159e4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions storage/io_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package storage

import (
"bytes"
"context"
"github.com/stretchr/testify/assert"
"io/ioutil"
"strings"
"testing"
"time"
)

// Basic test for reading small portion of data
func TestService_CopyStream(t *testing.T) {
s := Service{}

ctx, _ := context.WithTimeout(context.TODO(), time.Second*5)

readStream := ioutil.NopCloser(strings.NewReader("hello-world"))
var writeStream bytes.Buffer
buff := make([]byte, 11)

_, _ = s.CopyStream(ctx, readStream, &writeStream, 1024, &NestedStreamMiddlewares{})
_, _ = writeStream.Read(buff)

assert.Equal(t, "hello-world", string(buff))
}

0 comments on commit 0d159e4

Please sign in to comment.