style: format tests and helpers

This commit is contained in:
Peter Steinberger
2026-01-04 14:57:50 +00:00
parent 557aa74ee8
commit c6b8235862
9 changed files with 28 additions and 15 deletions

View File

@@ -1,9 +1,6 @@
import { describe, expect, it } from "vitest";
import {
buildSandboxCreateArgs,
type SandboxDockerConfig,
} from "./sandbox.js";
import { buildSandboxCreateArgs, type SandboxDockerConfig } from "./sandbox.js";
describe("buildSandboxCreateArgs", () => {
it("includes hardening and resource flags", () => {

View File

@@ -60,10 +60,7 @@ export type SandboxDockerConfig = {
memory?: string | number;
memorySwap?: string | number;
cpus?: number;
ulimits?: Record<
string,
string | number | { soft?: number; hard?: number }
>;
ulimits?: Record<string, string | number | { soft?: number; hard?: number }>;
seccompProfile?: string;
apparmorProfile?: string;
dns?: string[];

View File

@@ -219,7 +219,8 @@ describe("buildWorkspaceSkillsPrompt", () => {
dir: path.join(skillsDir, "anybin-skill"),
name: "anybin-skill",
description: "Needs any bin",
metadata: '{"clawdbot":{"requires":{"anyBins":["missingbin","fakebin"]}}}',
metadata:
'{"clawdbot":{"requires":{"anyBins":["missingbin","fakebin"]}}}',
});
await writeSkill({
dir: path.join(skillsDir, "config-skill"),

View File

@@ -289,7 +289,9 @@ function resolveClawdbotMetadata(
const osRaw = normalizeStringList(clawdbotObj.os);
return {
always:
typeof clawdbotObj.always === "boolean" ? clawdbotObj.always : undefined,
typeof clawdbotObj.always === "boolean"
? clawdbotObj.always
: undefined,
emoji:
typeof clawdbotObj.emoji === "string" ? clawdbotObj.emoji : undefined,
homepage:

View File

@@ -83,7 +83,12 @@ describe("buildStatusMessage", () => {
"./status.js"
);
const storePath = path.join(dir, ".clawdbot", "sessions", "sessions.json");
const storePath = path.join(
dir,
".clawdbot",
"sessions",
"sessions.json",
);
const sessionId = "sess-1";
const logPath = path.join(
dir,

View File

@@ -21,7 +21,9 @@ describe("gateway server models + voicewake", () => {
"voicewake.get returns defaults and voicewake.set broadcasts",
{ timeout: 15_000 },
async () => {
const homeDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-home-"));
const homeDir = await fs.mkdtemp(
path.join(os.tmpdir(), "clawdbot-home-"),
);
const prevHome = process.env.HOME;
process.env.HOME = homeDir;

View File

@@ -57,7 +57,9 @@ function initSelfPresence() {
const host = os.hostname();
const ip = resolvePrimaryIPv4() ?? undefined;
const version =
process.env.CLAWDBOT_VERSION ?? process.env.npm_package_version ?? "unknown";
process.env.CLAWDBOT_VERSION ??
process.env.npm_package_version ??
"unknown";
const modelIdentifier = (() => {
const p = os.platform();
if (p === "darwin") {

View File

@@ -91,7 +91,10 @@ describe("logger helpers", () => {
});
function pathForTest() {
const file = path.join(os.tmpdir(), `clawdbot-log-${crypto.randomUUID()}.log`);
const file = path.join(
os.tmpdir(),
`clawdbot-log-${crypto.randomUUID()}.log`,
);
fs.mkdirSync(path.dirname(file), { recursive: true });
return file;
}

View File

@@ -192,7 +192,11 @@ describe("web session", () => {
it("rotates creds backup when creds.json is valid JSON", async () => {
const credsSuffix = path.join(".clawdbot", "credentials", "creds.json");
const backupSuffix = path.join(".clawdbot", "credentials", "creds.json.bak");
const backupSuffix = path.join(
".clawdbot",
"credentials",
"creds.json.bak",
);
const copySpy = vi
.spyOn(fsSync, "copyFileSync")