1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use super::startup::get_cli_exe;
use assert_cmd::assert::OutputAssertExt;
mod commands;
pub use commands::VitCliCommand;
use jortestkit::process::output_extensions::ProcessOutput;
use std::path::PathBuf;
pub struct VitCli {
    exe: PathBuf,
}

impl Default for VitCli {
    fn default() -> Self {
        Self::new(get_cli_exe())
    }
}

impl VitCli {
    pub fn new(exe: PathBuf) -> Self {
        Self { exe }
    }

    pub fn generate_tokens(&self, n: u32) -> Vec<String> {
        let vit_command: VitCliCommand = VitCliCommand::new(self.exe.clone());
        vit_command
            .api_token()
            .generate()
            .n(n)
            .build()
            .assert()
            .get_output()
            .as_multi_line()
    }
}