verso-reader 0.1.0

A terminal EPUB reader with vim navigation, a Kindle-style library, and Markdown highlight export
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use verso::store::{
    books::{upsert, BookRow},
    db::Db,
    library_view::{list_rows, Filter, Sort},
};

#[test]
fn lists_rows_with_defaults() {
    let tmp = tempfile::NamedTempFile::new().unwrap();
    let db = Db::open(tmp.path()).unwrap();
    db.migrate().unwrap();
    upsert(&mut db.conn().unwrap(), &BookRow::new_fixture("a")).unwrap();
    upsert(&mut db.conn().unwrap(), &BookRow::new_fixture("b")).unwrap();
    let rows = list_rows(&db.conn().unwrap(), Sort::LastRead, Filter::All).unwrap();
    assert_eq!(rows.len(), 2);
    std::mem::forget(tmp);
}