helper.rs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. pub(crate) fn invalid_email_test_case() -> Vec<String> {
  2. // https://gist.github.com/cjaoude/fd9910626629b53c4d25
  3. vec![
  4. "",
  5. "annie@",
  6. "annie@gmail@",
  7. "#@%^%#$@#$@#.com",
  8. "@example.com",
  9. "Joe Smith <[email protected]>",
  10. "email.example.com",
  11. "email@[email protected]",
  12. "[email protected]",
  13. "[email protected]",
  14. "あいうえお@example.com",
  15. /* The following email is valid according to the validate_email function return
  16. * "[email protected]",
  17. * "[email protected]",
  18. * "[email protected]",
  19. * "email@example",
  20. * "[email protected]",
  21. * "[email protected]",
  22. * "[email protected]", */
  23. ]
  24. .iter()
  25. .map(|s| s.to_string())
  26. .collect::<Vec<_>>()
  27. }
  28. pub(crate) fn invalid_password_test_case() -> Vec<String> {
  29. vec!["", "123456", "1234".repeat(100).as_str()]
  30. .iter()
  31. .map(|s| s.to_string())
  32. .collect::<Vec<_>>()
  33. }
  34. pub(crate) fn valid_email() -> String { "[email protected]".to_string() }
  35. pub(crate) fn valid_password() -> String { "HelloWorld!123".to_string() }
  36. pub(crate) fn valid_name() -> String { "AppFlowy".to_string() }