mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-08-07 01:33:52 +00:00
feat: implement idx-cli MVP foundation, provider abstraction, and core quote/history commands
This commit is contained in:
parent
a4b8a1b64e
commit
2174b42cff
18 changed files with 2678 additions and 0 deletions
54
tests/cli.rs
Normal file
54
tests/cli.rs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
use assert_cmd::Command;
|
||||
use predicates::prelude::*;
|
||||
|
||||
#[test]
|
||||
fn help_works() {
|
||||
Command::cargo_bin("idx-cli")
|
||||
.expect("binary exists")
|
||||
.arg("--help")
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn version_prints_cargo_version() {
|
||||
Command::cargo_bin("idx-cli")
|
||||
.expect("binary exists")
|
||||
.arg("version")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains(env!("CARGO_PKG_VERSION")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn quote_with_mock_provider_json() {
|
||||
Command::cargo_bin("idx-cli")
|
||||
.expect("binary exists")
|
||||
.env("IDX_USE_MOCK_PROVIDER", "1")
|
||||
.args(["-o", "json", "stocks", "quote", "BBCA,BBRI"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("BBCA.JK"))
|
||||
.stdout(predicate::str::contains("BBRI.JK"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn history_with_mock_provider_json() {
|
||||
Command::cargo_bin("idx-cli")
|
||||
.expect("binary exists")
|
||||
.env("IDX_USE_MOCK_PROVIDER", "1")
|
||||
.args([
|
||||
"-o",
|
||||
"json",
|
||||
"stocks",
|
||||
"history",
|
||||
"BBCA",
|
||||
"--period",
|
||||
"3mo",
|
||||
"--interval",
|
||||
"1d",
|
||||
])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("2026-03-01"));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue