refactor(detect): create readUntilSafeBoundary + add tests (#1676)

This commit is contained in:
Richard Gomez authored and GitHub committed 2024-12-28 15:14:49 -06:00
1 parent dbe3746455
commit 4c3da6ebb7
5 files changed
+190 -62

No files matched your search

+8 -1
View File
@@ -1,11 +1,12 @@
package detect
import (
"github.com/stretchr/testify/require"
"io"
"strings"
"testing"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/assert"
)
@@ -13,11 +14,17 @@ const secret = "AKIAIRYLJVKMPEGZMPJS"
type mockReader struct {
data []byte
read bool
}
func (r *mockReader) Read(p []byte) (n int, err error) {
if r.read {
return 0, io.EOF
}
// Copy data to the provided buffer.
n = copy(p, r.data)
r.read = true
// Return io.EOF along with the bytes.
return n, io.EOF