Added playpen and mdbook init tests
This commit is contained in:
parent
9fab267da1
commit
e3f047a35d
|
@ -128,6 +128,38 @@ fn check_correct_cross_links_in_nested_dir() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_mdbook_init() {
|
||||
let created_files = vec!["book", "src", "src/SUMMARY.md", "src/chapter_1.md"];
|
||||
|
||||
let temp = TempDir::new("mdbook").unwrap();
|
||||
for file in &created_files {
|
||||
assert!(!temp.path().join(file).exists());
|
||||
}
|
||||
|
||||
let mut md = MDBook::new(temp.path());
|
||||
md.init().unwrap();
|
||||
|
||||
for file in &created_files {
|
||||
assert!(temp.path().join(file).exists(), "{} doesn't exist", file);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rendered_code_has_playpen_stuff() {
|
||||
let temp = create_book(true);
|
||||
let mut md = MDBook::new(temp.path());
|
||||
md.build().unwrap();
|
||||
|
||||
let nested = temp.path().join("book/first/nested.html");
|
||||
let playpen_class = vec![r#"class="playpen""#];
|
||||
|
||||
assert_contains_strings(nested, &playpen_class);
|
||||
|
||||
let book_js = temp.path().join("book/book.js");
|
||||
assert_contains_strings(book_js, &[".playpen"]);
|
||||
}
|
||||
|
||||
/// Create a dummy book in a temporary directory, using the contents of
|
||||
/// `SUMMARY_MD` as a guide.
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue