test: tighten gateway logging string assertions · openclaw/openclaw@2806e22
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -73,7 +73,7 @@ async function createNoisyPngBuffer(width: number, height: number): Promise<Buff
|
73 | 73 | } |
74 | 74 | |
75 | 75 | function requireAttachmentIdFromUrl(url: unknown): string { |
76 | | -expect(url).toEqual(expect.any(String)); |
| 76 | +expect(url).toBeTypeOf("string"); |
77 | 77 | const attachmentId = String(url).split("/").at(-2); |
78 | 78 | if (!attachmentId) { |
79 | 79 | throw new Error(`expected attachment id in URL ${String(url)}`); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -85,7 +85,7 @@ async function createFreshOperatorDevice(scopes: string[], nonce: string) {
|
85 | 85 | |
86 | 86 | async function connectOperator(ws: GatewaySocket, scopes: string[]) { |
87 | 87 | const nonce = await readConnectChallengeNonce(ws); |
88 | | -expect(nonce).toEqual(expect.any(String)); |
| 88 | +expect(nonce).toBeTypeOf("string"); |
89 | 89 | expect(String(nonce).length).toBeGreaterThan(0); |
90 | 90 | await connectOk(ws, { |
91 | 91 | token: "secret", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -149,7 +149,7 @@ describe("file log redaction", () => {
|
149 | 149 | |
150 | 150 | const [line] = fs.readFileSync(logPath, "utf8").trim().split("\n"); |
151 | 151 | const record = JSON.parse(line ?? "{}") as Record<string, unknown>; |
152 | | -expect(record.hostname).toEqual(expect.any(String)); |
| 152 | +expect(record.hostname).toBeTypeOf("string"); |
153 | 153 | expect(record.hostname).not.toBe(""); |
154 | 154 | expect(record.message).toBe("request completed"); |
155 | 155 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。