Files
trufflehog/pkg/handlers/ar_test.go
Amaan Ullah 0fa069c12f Enable errcheck and staticcheck for golangci-lint v2 and resolve all issues (#4924)
* enable errcheck and staticcheck for golangci-lint v2 and resolve all issues

* skip lint on intentional reference of deprecated DetectorType values
2026-05-15 17:07:14 +05:00

37 lines
715 B
Go

package handlers
import (
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/trufflesecurity/trufflehog/v3/pkg/context"
)
func TestHandleARFile(t *testing.T) {
file, err := os.Open("testdata/test.deb")
assert.Nil(t, err)
defer func() { _ = file.Close() }()
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
rdr, err := newFileReader(ctx, file)
assert.NoError(t, err)
defer func() { _ = rdr.Close() }()
handler := newARHandler()
dataOrErrChan := handler.HandleFile(context.AddLogger(ctx), rdr)
assert.NoError(t, err)
wantChunkCount := 102
count := 0
for range dataOrErrChan {
count++
}
assert.Equal(t, wantChunkCount, count)
}