From 33cc783318197908a07397f1d0af7e999a7abb46 Mon Sep 17 00:00:00 2001 From: kashif khan Date: Wed, 30 Oct 2024 10:55:39 +0500 Subject: [PATCH] added negative test cases for email pattern --- pkg/common/patterns_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/common/patterns_test.go b/pkg/common/patterns_test.go index b57023e0e0b4..329f4c7f8d1e 100644 --- a/pkg/common/patterns_test.go +++ b/pkg/common/patterns_test.go @@ -16,6 +16,7 @@ const ( func TestEmailRegexCheck(t *testing.T) { testEmails := ` + // positive cases standard email = john.doe@example.com subdomain email = jane_doe123@sub.domain.co.us organization email = alice.smith@test.org @@ -30,6 +31,12 @@ func TestEmailRegexCheck(t *testing.T) { dot email = test.email@my-email-service.xyz special char email = special@characters.com support email = support@customer-service.org + + // negative cases + not an email = abc.123@z + looks like email = test@user <- no domain + email but not = user12@service.COM <- capital letters not supported for domain + random text = here's some information about local-user@edu user ` expectedStr := []string{