providers/validate: Add test for {{isEnglish}}

This commit is contained in:
Sasha Koshka 2025-07-07 08:36:49 -04:00
parent 975d604e2f
commit 6c18c1c922

View File

@ -0,0 +1,38 @@
package validate
import "testing"
func TestFuncIsEnglish(test *testing.T) {
russian :=
"Качество изделия будет напрямую зависеть от точности " +
"соблюдения всех правил технологии выполнения " +
"https://some-random-scam-link-they-sent-me.com"
symbols :=
")(*#&$(*89347928374)(*/./,./,/,./.,) half is english but it " +
"will still be over the threshold"
english :=
"A limousine service offers luxurious, chauffeur-driven " +
"vehicles for various occasions. For Seattle residents and " +
"visitors, <a href=https://scam.com/> ScamTac airport limo " +
"service </a> is a popular choice. This service provides " +
"professional chauffeurs who ensure a smooth, comfortable " +
"ride to and from ScamTac airport. The fleet typically " +
"includes sedans, SUVs, and stretch limousines, catering to " +
"different group sizes and preferences. Key features include " +
"timely pick-ups, meet-and-greet services, and luggage " +
"assistance. Whether for business travel, special events, or " +
"simply a stress-free airport transfer, ScamTac airport limo " +
"service ensures a high-end travel experience. - " +
"https://scam.com/"
provider := new(Provider)
if got, correct := provider.funcIsEnglish(russian), false; got != correct {
test.Fatal("incorrect:", correct)
}
if got, correct := provider.funcIsEnglish(symbols), false; got != correct {
test.Fatal("incorrect:", correct)
}
if got, correct := provider.funcIsEnglish(english), true; got != correct {
test.Fatal("incorrect:", correct)
}
}