mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 21:30:42 +00:00
test: tighten gateway logging string assertions
This commit is contained in:
@@ -73,7 +73,7 @@ async function createNoisyPngBuffer(width: number, height: number): Promise<Buff
|
||||
}
|
||||
|
||||
function requireAttachmentIdFromUrl(url: unknown): string {
|
||||
expect(url).toEqual(expect.any(String));
|
||||
expect(url).toBeTypeOf("string");
|
||||
const attachmentId = String(url).split("/").at(-2);
|
||||
if (!attachmentId) {
|
||||
throw new Error(`expected attachment id in URL ${String(url)}`);
|
||||
|
||||
@@ -85,7 +85,7 @@ async function createFreshOperatorDevice(scopes: string[], nonce: string) {
|
||||
|
||||
async function connectOperator(ws: GatewaySocket, scopes: string[]) {
|
||||
const nonce = await readConnectChallengeNonce(ws);
|
||||
expect(nonce).toEqual(expect.any(String));
|
||||
expect(nonce).toBeTypeOf("string");
|
||||
expect(String(nonce).length).toBeGreaterThan(0);
|
||||
await connectOk(ws, {
|
||||
token: "secret",
|
||||
|
||||
@@ -149,7 +149,7 @@ describe("file log redaction", () => {
|
||||
|
||||
const [line] = fs.readFileSync(logPath, "utf8").trim().split("\n");
|
||||
const record = JSON.parse(line ?? "{}") as Record<string, unknown>;
|
||||
expect(record.hostname).toEqual(expect.any(String));
|
||||
expect(record.hostname).toBeTypeOf("string");
|
||||
expect(record.hostname).not.toBe("");
|
||||
expect(record.message).toBe("request completed");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user