fix(cli): reject partial numeric options · openclaw/openclaw@9755241
steipete
·
2026-05-28
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -880,7 +880,7 @@ describe("channelsAddCommand", () => {
|
880 | 880 | expect(runtime.exit).not.toHaveBeenCalled(); |
881 | 881 | }); |
882 | 882 | |
883 | | -it("drops malformed numeric channel setup options before plugin setup", async () => { |
| 883 | +it("rejects malformed numeric channel setup options before plugin setup", async () => { |
884 | 884 | const applyAccountConfig = vi.fn(({ cfg, input }: ApplyAccountConfigParams) => ({ |
885 | 885 | ...cfg, |
886 | 886 | channels: { |
@@ -898,21 +898,19 @@ describe("channelsAddCommand", () => {
|
898 | 898 | configMocks.readConfigFileSnapshot.mockResolvedValue({ ...baseConfigSnapshot }); |
899 | 899 | setActivePluginRegistry(createTestRegistry([{ pluginId: "matrix", plugin, source: "test" }])); |
900 | 900 | |
901 | | -await channelsAddCommand( |
902 | | -{ |
903 | | -channel: "matrix", |
904 | | -initialSyncLimit: "10x", |
905 | | -}, |
906 | | -runtime, |
907 | | -{ hasFlags: true }, |
908 | | -); |
| 901 | +await expect( |
| 902 | +channelsAddCommand( |
| 903 | +{ |
| 904 | +channel: "matrix", |
| 905 | +initialSyncLimit: "10x", |
| 906 | +}, |
| 907 | +runtime, |
| 908 | +{ hasFlags: true }, |
| 909 | +), |
| 910 | +).rejects.toThrow("--initial-sync-limit must be a non-negative integer."); |
909 | 911 | |
910 | | -expect(applyAccountConfig).toHaveBeenCalledTimes(1); |
911 | | -expect( |
912 | | -(applyAccountConfig.mock.calls[0]?.[0] as ApplyAccountConfigParams | undefined)?.input |
913 | | -.initialSyncLimit, |
914 | | -).toBeUndefined(); |
915 | | -expect(writtenChannel("matrix").initialSyncLimit).toBeUndefined(); |
| 912 | +expect(applyAccountConfig).not.toHaveBeenCalled(); |
| 913 | +expect(configMocks.writeConfigFile).not.toHaveBeenCalled(); |
916 | 914 | }); |
917 | 915 | |
918 | 916 | it("falls back from untrusted workspace catalog shadows when adding by alias", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。