fix(test): honor rpc rtt help flag · openclaw/openclaw@27450f6
vincentkoc
·
2026-06-20
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Measure Rpc Rtt tests cover measure rpc rtt script behavior. |
| 2 | +import { spawnSync } from "node:child_process"; |
2 | 3 | import { EventEmitter } from "node:events"; |
3 | 4 | import { describe, expect, it, vi } from "vitest"; |
4 | 5 | import { |
@@ -134,6 +135,20 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
|
134 | 135 | } |
135 | 136 | }); |
136 | 137 | |
| 138 | +it("prints usage for help without requiring an output directory", () => { |
| 139 | +expect(parseArgs(["--help"])).toMatchObject({ help: true }); |
| 140 | +expect(parseArgs(["-h"])).toMatchObject({ help: true }); |
| 141 | + |
| 142 | +const result = spawnSync(process.execPath, ["scripts/measure-rpc-rtt.mjs", "--help"], { |
| 143 | +cwd: process.cwd(), |
| 144 | +encoding: "utf8", |
| 145 | +}); |
| 146 | + |
| 147 | +expect(result.status).toBe(0); |
| 148 | +expect(result.stdout).toContain("Usage: node --import tsx scripts/measure-rpc-rtt.mjs"); |
| 149 | +expect(result.stderr).toBe(""); |
| 150 | +}); |
| 151 | + |
137 | 152 | it("does not publish zero-millisecond RPC RTT summaries", () => { |
138 | 153 | expect(summarizeRttSamples([0, 0.1, 0.49])).toEqual({ |
139 | 154 | avgMs: 1, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。