Git designed for AI agents.
package helper
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSanitizeString(t *testing.T) {
testCases := []struct {
input string
output string
}{
{"https://[email protected]/foo/bar", "https://[FILTERED]@gitlab.com/foo/bar"},
{"https://foo_the_user:[email protected]/foo/bar", "https://[FILTERED]@gitlab.com/foo/bar"},
{"proto://user:[email protected]", "proto://[FILTERED]@gitlab.com"},
{"some message proto://user:[email protected]", "some message proto://[FILTERED]@gitlab.com"},
{"test", "test"},
{"ssh://@gitlab.com", "ssh://@gitlab.com"},
}
for _, tc := range testCases {
assert.Equal(t, tc.output, SanitizeString(tc.input))
}
}