

























@@ -4,6 +4,7 @@ import type { ImageContent } from "@earendil-works/pi-ai";
44import { beforeEach, describe, expect, it, vi } from "vitest";
55import { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js";
66import { MAX_IMAGE_BYTES } from "../media/constants.js";
7+import { escapeRegExp } from "../shared/regexp.js";
78import {
89buildCliArgs,
910loadPromptRefImages,
@@ -224,10 +225,14 @@ describe("writeCliImages", () => {
224225});
225226226227try {
227-expect(first.paths).toHaveLength(1);
228+expect(first.paths).toStrictEqual([
229+expect.stringMatching(
230+new RegExp(
231+`^${escapeRegExp(`${resolvePreferredOpenClawTmpDir()}/openclaw-cli-images/`)}.*\\.png$`,
232+),
233+),
234+]);
228235expect(second.paths).toEqual(first.paths);
229-expect(first.paths[0]).toContain(`${resolvePreferredOpenClawTmpDir()}/openclaw-cli-images/`);
230-expect(first.paths[0]).toMatch(/\.png$/);
231236await expect(fs.readFile(first.paths[0])).resolves.toEqual(Buffer.from(image.data, "base64"));
232237} finally {
233238await fs.rm(first.paths[0], { force: true });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。