Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/locales/en/internet/domain_suffix.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use crate::utils::seeder;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(js_name = internet_domain_suffix)]
pub fn domain_suffix() -> String {
EN_DOMAIN_SUFFIX[seeder::gen_range(0..EN_DOMAIN_SUFFIX_LEN)].to_string()
}

static EN_DOMAIN_SUFFIX: [&'static str; 6] = [
"com",
"biz",
"info",
"name",
"net",
"org",
];
static EN_DOMAIN_SUFFIX_LEN: usize = EN_DOMAIN_SUFFIX.len();

// #[cfg(test)]
// mod tests {
// use super::*;

// #[test]
// fn test_item_is_in_list() {
// let result = domain_suffix();
// assert!(EN_DOMAIN_SUFFIX.contains(&result.as_str()), "The animal should be in the ANIMALS list.");
// }

// #[test]
// fn test_len() {
// let length = 6;
// assert!(EN_DOMAIN_SUFFIX.len() == length, "The length of the list is not equal to the setting.");
// }


// }
33 changes: 33 additions & 0 deletions src/locales/en/internet/example_email.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use crate::utils::seeder;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(js_name = internet_example_email)]
pub fn example_email() -> String {
EN_EXAMPLE_EMAIL[seeder::gen_range(0..EN_EXAMPLE_EMAIL_LEN)].to_string()
}

static EN_EXAMPLE_EMAIL: [&'static str; 3] = [
"example.org",
"example.com",
"example.net",
];
static EN_EXAMPLE_EMAIL_LEN: usize = EN_EXAMPLE_EMAIL.len();

// #[cfg(test)]
// mod tests {
// use super::*;

// #[test]
// fn test_item_is_in_list() {
// let result = example_email();
// assert!(EN_EXAMPLE_EMAIL.contains(&result.as_str()), "The animal should be in the ANIMALS list.");
// }

// #[test]
// fn test_len() {
// let length = 3;
// assert!(EN_EXAMPLE_EMAIL.len() == length, "The length of the list is not equal to the setting.");
// }


// }
33 changes: 33 additions & 0 deletions src/locales/en/internet/free_email.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use crate::utils::seeder;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(js_name = internet_free_mail)]
pub fn free_mail() -> String {
EN_FREE_MAIL[seeder::gen_range(0..EN_FREE_MAIL_LEN)].to_string()
}

static EN_FREE_MAIL: [&'static str; 3] = [
"gmail.com",
"yahoo.com",
"hotmail.com",
];
static EN_FREE_MAIL_LEN: usize = EN_FREE_MAIL.len();

// #[cfg(test)]
// mod tests {
// use super::*;

// #[test]
// fn test_item_is_in_list() {
// let result = free_mail();
// assert!(EN_FREE_MAIL.contains(&result.as_str()), "The animal should be in the ANIMALS list.");
// }

// #[test]
// fn test_len() {
// let length = 3;
// assert!(EN_FREE_MAIL.len() == length, "The length of the list is not equal to the setting.");
// }


// }
3 changes: 3 additions & 0 deletions src/locales/en/internet/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod free_email;
pub mod domain_suffix;
pub mod example_email;
1 change: 1 addition & 0 deletions src/locales/en/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ pub mod color;
pub mod app;
pub mod lorem;
pub mod team;
pub mod internet;