























@@ -75,6 +75,34 @@ function createScanResult() {
7575};
7676}
777778+function createExpectedStatusPayload() {
79+return {
80+ok: true,
81+configuredChannels: [],
82+os: { platform: "linux" },
83+update: { installKind: "npm", git: { tag: null, branch: null } },
84+updateChannel: "stable",
85+updateChannelSource: "config",
86+memory: null,
87+memoryPlugin: null,
88+gateway: {
89+mode: "local",
90+url: "ws://127.0.0.1:18789",
91+urlSource: "config",
92+misconfigured: false,
93+reachable: false,
94+connectLatencyMs: null,
95+self: null,
96+error: null,
97+authWarning: null,
98+},
99+gatewayService: { installed: false },
100+nodeService: { installed: false },
101+agents: [],
102+secretDiagnostics: [],
103+};
104+}
105+78106describe("statusJsonCommand", () => {
79107beforeEach(() => {
80108vi.clearAllMocks();
@@ -97,20 +125,7 @@ describe("statusJsonCommand", () => {
97125expect(mocks.runSecurityAudit).not.toHaveBeenCalled();
98126expect(logs).toStrictEqual([expect.any(String)]);
99127const payload = JSON.parse(logs[0] ?? "{}") as Record<string, unknown>;
100-expect(payload).toMatchObject({
101-ok: true,
102-configuredChannels: [],
103-os: { platform: "linux" },
104-update: { installKind: "npm", git: { tag: null, branch: null } },
105-updateChannel: "stable",
106-updateChannelSource: "config",
107-memory: null,
108-memoryPlugin: null,
109-gatewayService: { installed: false },
110-nodeService: { installed: false },
111-agents: [],
112-secretDiagnostics: [],
113-});
128+expect(payload).toEqual(createExpectedStatusPayload());
114129expect(payload).not.toHaveProperty("securityAudit");
115130});
116131@@ -147,8 +162,8 @@ describe("statusJsonCommand", () => {
147162]);
148163expect(logs).toStrictEqual([expect.any(String)]);
149164const payload = JSON.parse(logs[0] ?? "{}") as Record<string, unknown>;
150-expect(payload).toMatchObject({
151-ok: true,
165+expect(payload).toEqual({
166+...createExpectedStatusPayload(),
152167securityAudit: {
153168summary: { critical: 1, warn: 0, info: 0 },
154169findings: [],
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。