Skip to content

Commit

Permalink
test: Add unit test for project open
Browse files Browse the repository at this point in the history
  • Loading branch information
brianp committed Dec 30, 2019
1 parent 6de392f commit 7c83027
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions load/src/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,26 @@ mod test {
let _ = fs::remove_file(&project_paths.project_file);
assert!(result.is_ok());
}

#[test]
fn open_returns_attach_in_bare_context() {
let attach_command = match open("muxed") {
Commands::Attach(_) => true,
_ => false,
};

assert!(attach_command);
}

#[test]
fn open_returns_switch_client_in_nested_context() {
let _ = env::set_var(TMUX_ENV_VAR, "somestring");
let switch_command = match open("muxed") {
Commands::SwitchClient(_) => true,
_ => false,
};
let _ = env::remove_var(TMUX_ENV_VAR);

assert!(switch_command);
}
}

0 comments on commit 7c83027

Please sign in to comment.