-
Notifications
You must be signed in to change notification settings - Fork 0
/
log_test.go
18 lines (16 loc) · 651 Bytes
/
log_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package venom
import (
"context"
"github.com/stretchr/testify/assert"
"testing"
)
func TestHideSensitive(t *testing.T) {
ctx := context.Background()
ctx = context.WithValue(ctx, ContextKey("secrets"), []string{"Joe", "Doe"})
assert.Equal(t, "__hidden__", HideSensitive(ctx, "Joe"))
assert.Equal(t, "__hidden__ tests something", HideSensitive(ctx, "Joe tests something"))
assert.Equal(t, "Dave tests something", HideSensitive(ctx, "Dave tests something"))
assert.Equal(t, "1234", HideSensitive(ctx, 1234))
assert.Equal(t, "__hidden__!", HideSensitive(ctx, "Doe!"))
assert.Equal(t, "__hidden__ __hidden__", HideSensitive(ctx, "Joe Doe"))
}