diff options
Diffstat (limited to 'internal/handlers/util_test.go')
| -rw-r--r-- | internal/handlers/util_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/handlers/util_test.go b/internal/handlers/util_test.go new file mode 100644 index 000000000..f5bf7f7ab --- /dev/null +++ b/internal/handlers/util_test.go @@ -0,0 +1,24 @@ +package handlers + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestRedactEmail(t *testing.T) { + testCases := []struct { + testName string + input string + expected string + }{ + {"ShouldRedactEmail", "james.dean@authelia.com", "j********n@authelia.com"}, + {"ShouldRedactShortEmail", "me@authelia.com", "**@authelia.com"}, + {"ShouldRedactInvalidEmail", "invalidEmail.com", ""}, + } + for _, tc := range testCases { + t.Run(tc.testName, func(t *testing.T) { + require.Equal(t, tc.expected, redactEmail(tc.input)) + }) + } +} |
