test: tighten small status model assertions · openclaw/openclaw@0a13bd5
steipete
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -308,12 +308,8 @@ describe("gateway-status local target scheme", () => {
|
308 | 308 | }; |
309 | 309 | |
310 | 310 | const targets = resolveTargets(cfg as never); |
311 | | -expect(targets).toContainEqual( |
312 | | -expect.objectContaining({ |
313 | | -id: "localLoopback", |
314 | | -url: "wss://127.0.0.1:18789", |
315 | | -}), |
316 | | -); |
| 311 | +const localLoopbackTarget = targets.find((target) => target.id === "localLoopback"); |
| 312 | +expect(localLoopbackTarget?.url).toBe("wss://127.0.0.1:18789"); |
317 | 313 | |
318 | 314 | const hints = buildNetworkHints(cfg as never); |
319 | 315 | expect(hints.localLoopbackUrl).toBe("wss://127.0.0.1:18789"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -96,20 +96,23 @@ describe("modelsAuthListCommand", () => {
|
96 | 96 | }); |
97 | 97 | expect(runtime.jsonPayloads).toHaveLength(1); |
98 | 98 | expect(JSON.stringify(runtime.jsonPayloads[0])).not.toContain("secret"); |
99 | | -expect(runtime.jsonPayloads[0]).toMatchObject({ |
100 | | -agentId: "coder", |
101 | | -provider: "openai-codex", |
102 | | -profiles: [ |
103 | | -{ |
104 | | -id: "openai-codex:user@example.com", |
105 | | -provider: "openai-codex", |
106 | | -type: "oauth", |
107 | | -email: "user@example.com", |
108 | | -expiresAt: "2027-01-15T08:00:00.000Z", |
109 | | -cooldownUntil: "2027-01-15T08:00:10.000Z", |
110 | | -}, |
111 | | -], |
112 | | -}); |
| 99 | +const payload = runtime.jsonPayloads[0] as |
| 100 | +| { |
| 101 | +agentId?: unknown; |
| 102 | +provider?: unknown; |
| 103 | +profiles?: Array<Record<string, unknown>>; |
| 104 | +} |
| 105 | +| undefined; |
| 106 | +expect(payload?.agentId).toBe("coder"); |
| 107 | +expect(payload?.provider).toBe("openai-codex"); |
| 108 | +expect(payload?.profiles).toHaveLength(1); |
| 109 | +const [profile] = payload?.profiles ?? []; |
| 110 | +expect(profile?.id).toBe("openai-codex:user@example.com"); |
| 111 | +expect(profile?.provider).toBe("openai-codex"); |
| 112 | +expect(profile?.type).toBe("oauth"); |
| 113 | +expect(profile?.email).toBe("user@example.com"); |
| 114 | +expect(profile?.expiresAt).toBe("2027-01-15T08:00:00.000Z"); |
| 115 | +expect(profile?.cooldownUntil).toBe("2027-01-15T08:00:10.000Z"); |
113 | 116 | }); |
114 | 117 | |
115 | 118 | it("prints an empty profile list without failing", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -25,10 +25,8 @@ describe("toModelRow", () => {
|
25 | 25 | tags: [], |
26 | 26 | }); |
27 | 27 | |
28 | | -expect(row).toMatchObject({ |
29 | | -contextWindow: 400_000, |
30 | | -contextTokens: 272_000, |
31 | | -}); |
| 28 | +expect(row.contextWindow).toBe(400_000); |
| 29 | +expect(row.contextTokens).toBe(272_000); |
32 | 30 | }); |
33 | 31 | |
34 | 32 | it("marks models available from auth profiles without loading model discovery", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -36,13 +36,10 @@ describe("status daemon summary", () => {
|
36 | 36 | }, |
37 | 37 | }); |
38 | 38 | |
39 | | -await expect(getDaemonStatusSummary()).resolves.toMatchObject({ |
40 | | -runtimeShort: expect.stringContaining("running"), |
41 | | -layout: { |
42 | | -execStart: "/usr/bin/node /opt/openclaw/dist/entry.js gateway", |
43 | | -sourceScope: "system", |
44 | | -entrypointSourceCheckout: false, |
45 | | -}, |
46 | | -}); |
| 39 | +const summary = await getDaemonStatusSummary(); |
| 40 | +expect(summary.runtimeShort).toContain("running"); |
| 41 | +expect(summary.layout?.execStart).toBe("/usr/bin/node /opt/openclaw/dist/entry.js gateway"); |
| 42 | +expect(summary.layout?.sourceScope).toBe("system"); |
| 43 | +expect(summary.layout?.entrypointSourceCheckout).toBe(false); |
47 | 44 | }); |
48 | 45 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。