mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 09:45:36 +00:00
test: replace mock smoke matrix with a live-only drift check
The 43-case mock smoke duplicated tests/cli.rs, which already runs the real binary against fixture providers. Replace the flake's smoke-mock check with a small packaged-cli check (version JSON, bash completions, one mock quote), and cut scripts/live-smoke.sh from 672 to ~170 lines: it now only runs shipped commands against live MSN/Yahoo/IDX and validates output shape. Rewrite docs/SMOKE.md around the Nix gate and the drift check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1631058b8c
commit
86c108f6eb
7 changed files with 188 additions and 771 deletions
16
flake.nix
16
flake.nix
|
|
@ -189,19 +189,19 @@
|
|||
doInstallCargoArtifacts = false;
|
||||
installPhaseCommand = "touch $out";
|
||||
});
|
||||
smoke-mock = pkgs.runCommand "idx-smoke-mock"
|
||||
{ nativeBuildInputs = with pkgs; [ bash coreutils diffutils findutils gnugrep gnused gawk jq ]; }
|
||||
# Sanity check of the packaged (wrapped) binary; CLI behavior is
|
||||
# covered by tests/cli.rs.
|
||||
packaged-cli = pkgs.runCommand "idx-packaged-cli"
|
||||
{ nativeBuildInputs = with pkgs; [ bash jq ]; }
|
||||
''
|
||||
mkdir -p scripts
|
||||
cp ${./scripts/live-smoke.sh} scripts/live-smoke.sh
|
||||
chmod u+w scripts/live-smoke.sh
|
||||
patchShebangs scripts/live-smoke.sh
|
||||
# The mock provider reads fixtures relative to the working dir.
|
||||
mkdir -p tests
|
||||
cp -r ${./tests/fixtures} tests/fixtures
|
||||
export HOME="$TMPDIR"
|
||||
${idxPackage}/bin/idx version
|
||||
bash scripts/live-smoke.sh --bin ${idxPackage}/bin/idx --no-build --mode mock
|
||||
${idxPackage}/bin/idx -o json version | jq -e '.version | type == "string"'
|
||||
${idxPackage}/bin/idx completions bash | bash -n
|
||||
IDX_USE_MOCK_PROVIDER=1 ${idxPackage}/bin/idx -o json stocks quote BBCA \
|
||||
| jq -e '.[0].price | type == "number"'
|
||||
touch "$out"
|
||||
'';
|
||||
install-script-sh = installerCheck "sh";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue