aboutsummaryrefslogtreecommitdiff
path: root/tests/test_blog.rs
blob: 6cd32495f611123f689f10cf5a47aac0290b8a69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use macroblog::blog::*;
use macroblog::assets::*;

use chrono::NaiveDate;


#[test]
fn test_create_blog_entry() {
    let asset_filename = String::from("2021-12-03Enable_NFS_on_K3S.md");
    let post_date = NaiveDate::from_ymd(2021, 12, 03);

    let blog_entry = BlogEntry::new(&asset_filename);

    assert_eq!(blog_entry.title, "Enable NFS on K3S");
    assert_eq!(blog_entry.datetime, post_date);
}

#[test]
fn test_read_assets() {
    // This test meant to test if all files are parsed correctly
    let assets = read_assets();
    assert!(assets.iter().count() > 1)
}

#[test]
fn test_render_post_page() {
    let path = &String::from("2020-07-14Friz_box_turned_off_DHCP.md");
    let page = render_post_page(path);
    assert!(!page.is_empty());
}


#[test]
fn test_render_index_page() {
    let page = render_index_page();
    assert!(!page.is_empty());
}