Debian Codegraph @

pkg/transformers/tests/helpers.go

raw symbols SCIP
1 package tests
2
3 import (
4 "testing"
5
6 "github.com/DefangLabs/secret-detector/pkg/secrets"
7 "github.com/stretchr/testify/assert"
8 )
9
10 type TestCase struct {
11 Name, Input string
12 Expected map[string]string
13 }
14
15 func TestTransform(t *testing.T, transformer secrets.Transformer, testCases []TestCase) {
16 t.Helper()
17
18 for _, test := range testCases {
19 t.Run(test.Name, func(t *testing.T) {
20 actual, ok := transformer.Transform(test.Input)
21
22 assert.Equal(t, test.Expected != nil, ok)
23 assert.Equal(t, test.Expected, actual)
24 })
25 }
26 }