//! `tfd reddit` clap surface (generated from REDDIT_COMMANDS). No daemon needed:
//! --help and usage errors are produced by clap before any socket connection.

use assert_cmd::Command;

fn tfd() -> Command {
    Command::cargo_bin("tfd").unwrap()
}

#[test]
fn tfd_reddit_help_lists_subcommands() {
    let out = tfd().args(["reddit", "--help"]).output().unwrap();
    let text = String::from_utf8_lossy(&out.stdout);
    for sub in ["hot", "search", "subreddit", "read", "comment", "subscribe"] {
        assert!(
            text.contains(sub),
            "tfd reddit --help missing `{sub}`:\n{text}"
        );
    }
}

#[test]
fn tfd_reddit_unknown_command_errors() {
    tfd()
        .args(["reddit", "definitely-not-a-command"])
        .assert()
        .failure();
}
