Skip to content

Commit

Permalink
Add UI snapshot test for simple case
Browse files Browse the repository at this point in the history
  • Loading branch information
cruessler committed Sep 23, 2024
1 parent 11a0b9b commit 72fc309
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 0 deletions.
97 changes: 97 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ which = "6.0"
[dev-dependencies]
env_logger = "0.11"
pretty_assertions = "1.4"
snapbox = { version = "0.6.16", features = ["cmd", "term-svg"] }
tempfile = "3"

[build-dependencies]
Expand Down
27 changes: 27 additions & 0 deletions tests/fixtures/empty_dir.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions tests/ui.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::path::Path;

use snapbox::{cmd::Command, data::DataFormat, Data};
use tempfile::TempDir;

#[test]
fn test_empty_dir() {
let path: &Path = Path::new("tests/fixtures/empty_dir.svg");

let empty_dir = TempDir::new().unwrap();

Command::new("gitui")
.current_dir(empty_dir.path())
.assert()
.success()
.stderr_eq(Data::read_from(path, Some(DataFormat::TermSvg)));
}

0 comments on commit 72fc309

Please sign in to comment.