-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49108f2
commit 5e88664
Showing
17 changed files
with
585 additions
and
135 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#[cfg(test)] | ||
mod tests { | ||
use ssg::modules::cname::create_cname_data; | ||
use std::collections::HashMap; | ||
|
||
#[test] | ||
fn test_create_cname_data_with_valid_cname() { | ||
let mut metadata = HashMap::new(); | ||
metadata.insert("cname".to_string(), "example.com".to_string()); | ||
|
||
let cname_data = create_cname_data(&metadata); | ||
|
||
assert_eq!(cname_data.cname, "example.com"); | ||
} | ||
|
||
#[test] | ||
fn test_create_cname_data_with_missing_cname() { | ||
let metadata = HashMap::new(); // Empty metadata | ||
|
||
let cname_data = create_cname_data(&metadata); | ||
|
||
assert_eq!(cname_data.cname, ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#[cfg(test)] | ||
mod tests { | ||
use ssg::modules::human::create_human_data; | ||
use std::collections::HashMap; | ||
|
||
#[test] | ||
fn test_create_human_data_with_all_fields() { | ||
let mut metadata = HashMap::new(); | ||
metadata.insert("author_location".to_string(), "Location".to_string()); | ||
metadata.insert("author_twitter".to_string(), "@twitter_handle".to_string()); | ||
metadata.insert("author_website".to_string(), "https://example.com".to_string()); | ||
metadata.insert("author".to_string(), "John Doe".to_string()); | ||
metadata.insert("site_components".to_string(), "Components".to_string()); | ||
metadata.insert("site_last_updated".to_string(), "2023-01-01".to_string()); | ||
metadata.insert("site_software".to_string(), "Software".to_string()); | ||
metadata.insert("site_standards".to_string(), "Standards".to_string()); | ||
metadata.insert("thanks".to_string(), "Contributors".to_string()); | ||
|
||
let human_data = create_human_data(&metadata); | ||
|
||
assert_eq!(human_data.author_location, "Location"); | ||
assert_eq!(human_data.author_twitter, "@twitter_handle"); | ||
assert_eq!(human_data.author_website, "https://example.com"); | ||
assert_eq!(human_data.author, "John Doe"); | ||
assert_eq!(human_data.site_components, "Components"); | ||
assert_eq!(human_data.site_last_updated, "2023-01-01"); | ||
assert_eq!(human_data.site_software, "Software"); | ||
assert_eq!(human_data.site_standards, "Standards"); | ||
assert_eq!(human_data.thanks, "Contributors"); | ||
} | ||
|
||
#[test] | ||
fn test_create_human_data_with_missing_fields() { | ||
let metadata = HashMap::new(); // Empty metadata | ||
|
||
let human_data = create_human_data(&metadata); | ||
|
||
assert_eq!(human_data.author_location, ""); | ||
assert_eq!(human_data.author_twitter, ""); | ||
assert_eq!(human_data.author_website, ""); | ||
assert_eq!(human_data.author, ""); | ||
assert_eq!(human_data.site_components, ""); | ||
assert_eq!(human_data.site_last_updated, ""); | ||
assert_eq!(human_data.site_software, ""); | ||
assert_eq!(human_data.site_standards, ""); | ||
assert_eq!(human_data.thanks, ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#[cfg(test)] | ||
mod tests { | ||
use ssg::modules::keywords::extract_keywords; | ||
use std::collections::HashMap; | ||
|
||
#[test] | ||
fn test_extract_keywords_with_valid_keywords() { | ||
let mut metadata = HashMap::new(); | ||
metadata.insert("keywords".to_string(), "rust,programming,testing".to_string()); | ||
|
||
let keywords = extract_keywords(&metadata); | ||
|
||
assert_eq!(keywords, vec!["rust", "programming", "testing"]); | ||
} | ||
|
||
#[test] | ||
fn test_extract_keywords_with_missing_keywords() { | ||
let metadata = HashMap::new(); // Empty metadata | ||
|
||
let keywords = extract_keywords(&metadata); | ||
|
||
assert_eq!(keywords, Vec::<String>::new()); | ||
} | ||
|
||
#[test] | ||
fn test_extract_keywords_with_whitespace() { | ||
let mut metadata = HashMap::new(); | ||
metadata.insert("keywords".to_string(), " rust , programming , testing ".to_string()); | ||
|
||
let keywords = extract_keywords(&metadata); | ||
|
||
assert_eq!(keywords, vec!["rust", "programming", "testing"]); | ||
} | ||
} |
Oops, something went wrong.