use pretty_assertions::assert_eq;
use super::{placement, Placement};
use crate::daemon::login_session::LoginSession;
#[test]
fn only_a_client_outside_an_existing_gui_login_starts_the_daemon_through_launchd() {
let gui = Some(LoginSession::Gui);
let background = Some(LoginSession::Background);
for (case, client, gui_login, expected) in [
(
"ssh login, user at the screen",
background,
true,
Placement::LaunchAgent,
),
(
"ssh login, nobody at the screen",
background,
false,
Placement::ClientSession,
),
(
"terminal in the GUI login",
gui,
true,
Placement::ClientSession,
),
(
"no login sessions (Linux)",
None,
false,
Placement::ClientSession,
),
] {
assert_eq!(placement(client, || gui_login), expected, "{case}");
}
}