helper.rs 1.4 KB

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