macroblog.rs @ e44658641b75076b702e690df166820c1d133f24

 1use macroblog::blog::*;
 2
 3use chrono::NaiveDate;
 4
 5
 6#[test]
 7fn test_create_blog_entry() {
 8    let asset_filename = String::from("2021-12-03Enable_NFS_on_K3S.html");
 9    let post_date = NaiveDate::from_ymd(2021, 12, 03);
10
11    let blog_entry = BlogEntry::new(&asset_filename);
12
13    assert_eq!(blog_entry.title, "Enable NFS on K3S");
14    assert_eq!(blog_entry.datetime, post_date);
15}
16
17#[test]
18fn test_read_assets() {
19    // This test meant to test if all files are parsed correctly
20    let assets = BlogEntry::read_assets();
21    assert!(assets.iter().count() > 1)
22}
23
24#[test]
25fn test_render_post_page() {
26    let path = &String::from("2020-07-14Friz_box_turned_off_DHCP.html");
27    let page = render_post_page(path);
28    assert!(!page.is_empty());
29}
30
31
32#[test]
33fn test_render_index_page() {
34    let page = render_index_page();
35    assert!(!page.is_empty());
36}