mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-15 15:13:48 -06:00
c70aee247e
* refactor(scripts): migrate JavaScript tools to TypeScript * fix(ci): keep changed-scope preflight zero-install * fix(ci): preserve zero-install script owners * fix(ci): complete script migration follow-through * fix(release): keep stable closeout zero-install * fix(scripts): preserve standalone execution boundaries * fix(scripts): repair standalone loader boundaries * fix(scripts): normalize gateway observation ids * fix(scripts): keep Docker packager standalone * test(scripts): preserve rebase cleanup helpers * test(sessions): use tracked temp directory
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
// Check No Random Messaging Tmp tests cover check no random messaging tmp script behavior.
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
findMessagingTmpdirCallLines,
|
|
messagingTmpdirGuardSourceRoots,
|
|
} from "../../scripts/check-no-random-messaging-tmp.mts";
|
|
|
|
describe("check-no-random-messaging-tmp", () => {
|
|
it("finds os.tmpdir calls imported from node:os", () => {
|
|
const source = `
|
|
import os from "node:os";
|
|
const dir = os.tmpdir();
|
|
`;
|
|
expect(findMessagingTmpdirCallLines(source)).toEqual([3]);
|
|
});
|
|
|
|
it("finds tmpdir named import calls from node:os", () => {
|
|
const source = `
|
|
import { tmpdir } from "node:os";
|
|
const dir = tmpdir();
|
|
`;
|
|
expect(findMessagingTmpdirCallLines(source)).toEqual([3]);
|
|
});
|
|
|
|
it("finds tmpdir calls imported from os", () => {
|
|
const source = `
|
|
import os from "os";
|
|
const dir = os.tmpdir();
|
|
`;
|
|
expect(findMessagingTmpdirCallLines(source)).toEqual([3]);
|
|
});
|
|
|
|
it("ignores mentions in comments and strings", () => {
|
|
const source = `
|
|
// os.tmpdir()
|
|
const text = "tmpdir()";
|
|
`;
|
|
expect(findMessagingTmpdirCallLines(source)).toStrictEqual([]);
|
|
});
|
|
|
|
it("ignores tmpdir symbols that are not imported from node:os", () => {
|
|
const source = `
|
|
const tmpdir = () => "/tmp";
|
|
const dir = tmpdir();
|
|
`;
|
|
expect(findMessagingTmpdirCallLines(source)).toStrictEqual([]);
|
|
});
|
|
|
|
it("guards src/media against host tmpdir usage", () => {
|
|
expect(messagingTmpdirGuardSourceRoots).toContain("src/media");
|
|
});
|
|
});
|