diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 11:59:00 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 11:59:00 +0800 |
| commit | 8d98ba88f75852f5cc4b5d66c5b30210b7eefe6c (patch) | |
| tree | aba9aa2210103460935fd1a9baa0b9f4e69efdca /qa | |
| parent | 4ff91444dc9f29acf6f8459572a6cbf7db676b59 (diff) | |
| download | fund-lab-8d98ba88f75852f5cc4b5d66c5b30210b7eefe6c.tar.gz | |
Backfill cash ledger from historical transactions and add reconciliation QA (3d-32)
Diffstat (limited to 'qa')
| -rwxr-xr-x | qa/run.sh | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -110,6 +110,37 @@ for _ in $(seq 1 60); do done [ "$api_up" = 1 ] || { cat "$API_LOG" >&2; die "API did not become ready"; } +log "checking cash-reconciliation API (curl assertion)" +RECON_FUND_ID="$(curl -s -X POST "http://127.0.0.1:$API_PORT/api/funds" \ + -H "Authorization: Bearer $AUTH_TOKEN" \ + -H "Content-Type: application/json" \ + -H "Idempotency-Key: qa-recon-fund-$RANDOM" \ + -d '{"name":"QA 现金对账","initialCash":"1000.00","initialUnitNav":"1.00000000","isSynthetic":true}' \ + | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')" +[ -n "$RECON_FUND_ID" ] || die "cash reconciliation assertion: fund creation failed" + +curl -s -X POST "http://127.0.0.1:$API_PORT/api/funds/$RECON_FUND_ID/capital/deposit" \ + -H "Authorization: Bearer $AUTH_TOKEN" \ + -H "Content-Type: application/json" \ + -H "Idempotency-Key: qa-recon-deposit-$RANDOM" \ + -d '{"amount":"2500.00","note":"qa"}' >/dev/null + +curl -s -H "Authorization: Bearer $AUTH_TOKEN" "http://127.0.0.1:$API_PORT/api/funds/$RECON_FUND_ID/cash-reconciliation" \ + | python3 -c ' +import sys, json +d = json.load(sys.stdin) +required = ["openingCash", "netInflow", "closingCash", "ledgerBalance", "difference", "sources", "events"] +missing = [k for k in required if k not in d] +assert not missing, "missing fields: %s" % missing +assert d["difference"] == "0.00", "difference=%s" % d["difference"] +assert d["openingCash"] == "1000.00", d["openingCash"] +assert d["closingCash"] == "3500.00", d["closingCash"] +src = {s["source"]: s for s in d["sources"]} +assert src.get("capital_deposit", {}).get("netAmount") == "2500.00", d["sources"] +assert src["capital_deposit"]["eventCount"] == 1, d["sources"] +print("PASS C1 现金对账字段齐全且 difference==0 -- diff=%s sources=%s" % (d["difference"], d["sources"])) +' || die "cash reconciliation curl assertion failed" + log "compiling F# to JS (fable)" ( cd "$ROOT/src/FundLab.Web" && dotnet fable FundLab.Web.fsproj --outDir dist --noCache ) > "$TMP_DIR/fable.log" 2>&1 |
