style(tests): format imports

This commit is contained in:
Peter Steinberger
2025-12-12 16:47:10 +00:00
parent debcf19199
commit 7a1d64fff9
5 changed files with 106 additions and 92 deletions

View File

@@ -1,6 +1,6 @@
import fs from "node:fs/promises";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import fs from "node:fs/promises";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { import {

View File

@@ -1,7 +1,7 @@
import fs from "node:fs/promises"; import fs from "node:fs/promises";
import { type AddressInfo, createServer } from "node:net";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import { type AddressInfo, createServer } from "node:net";
import { describe, expect, test, vi } from "vitest"; import { describe, expect, test, vi } from "vitest";
import { WebSocket } from "ws"; import { WebSocket } from "ws";
import { agentCommand } from "../commands/agent.js"; import { agentCommand } from "../commands/agent.js";

View File

@@ -1,5 +1,8 @@
export class GatewayLockError extends Error { export class GatewayLockError extends Error {
constructor(message: string, public readonly cause?: unknown) { constructor(
message: string,
public readonly cause?: unknown,
) {
super(message); super(message);
this.name = "GatewayLockError"; this.name = "GatewayLockError";
} }

View File

@@ -5,7 +5,7 @@ import os from "node:os";
import path from "node:path"; import path from "node:path";
import sharp from "sharp"; import sharp from "sharp";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { getReplyFromConfig } from "../auto-reply/reply.js";
import type { ClawdisConfig } from "../config/config.js"; import type { ClawdisConfig } from "../config/config.js";
import { resetLogger, setLoggerOverride } from "../logging.js"; import { resetLogger, setLoggerOverride } from "../logging.js";
import * as commandQueue from "../process/command-queue.js"; import * as commandQueue from "../process/command-queue.js";
@@ -18,7 +18,6 @@ import {
runWebHeartbeatOnce, runWebHeartbeatOnce,
stripHeartbeatToken, stripHeartbeatToken,
} from "./auto-reply.js"; } from "./auto-reply.js";
import { getReplyFromConfig } from "../auto-reply/reply.js";
import type { sendMessageWhatsApp } from "./outbound.js"; import type { sendMessageWhatsApp } from "./outbound.js";
import { import {
resetBaileysMocks, resetBaileysMocks,
@@ -565,7 +564,10 @@ describe("web auto-reply", () => {
await run; await run;
}); });
it("stops after hitting max reconnect attempts", { timeout: 20000 }, async () => { it(
"stops after hitting max reconnect attempts",
{ timeout: 20000 },
async () => {
const closeResolvers: Array<() => void> = []; const closeResolvers: Array<() => void> = [];
const sleep = vi.fn(async () => {}); const sleep = vi.fn(async () => {});
const listenerFactory = vi.fn(async () => { const listenerFactory = vi.fn(async () => {
@@ -606,7 +608,8 @@ describe("web auto-reply", () => {
expect(runtime.error).toHaveBeenCalledWith( expect(runtime.error).toHaveBeenCalledWith(
expect.stringContaining("max attempts reached"), expect.stringContaining("max attempts reached"),
); );
}); },
);
it("skips reply heartbeat when requests are running", async () => { it("skips reply heartbeat when requests are running", async () => {
const tmpDir = await fs.mkdtemp( const tmpDir = await fs.mkdtemp(

View File

@@ -566,7 +566,11 @@ describe("web monitor inbox", () => {
type: "notify", type: "notify",
messages: [ messages: [
{ {
key: { id: "no-config-1", fromMe: false, remoteJid: "999@s.whatsapp.net" }, key: {
id: "no-config-1",
fromMe: false,
remoteJid: "999@s.whatsapp.net",
},
message: { conversation: "ping" }, message: { conversation: "ping" },
messageTimestamp: 1_700_000_000, messageTimestamp: 1_700_000_000,
}, },
@@ -582,7 +586,11 @@ describe("web monitor inbox", () => {
type: "notify", type: "notify",
messages: [ messages: [
{ {
key: { id: "no-config-2", fromMe: false, remoteJid: "123@s.whatsapp.net" }, key: {
id: "no-config-2",
fromMe: false,
remoteJid: "123@s.whatsapp.net",
},
message: { conversation: "self ping" }, message: { conversation: "self ping" },
messageTimestamp: 1_700_000_001, messageTimestamp: 1_700_000_001,
}, },