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