perf(test): fold gmail watcher assertions into hooks install suite

This commit is contained in:
Peter Steinberger
2026-02-15 23:41:41 +00:00
parent 3fd40fc5a3
commit 5e3b211d93
2 changed files with 11 additions and 12 deletions

View File

@@ -1,12 +0,0 @@
import { describe, expect, it } from "vitest";
import { isAddressInUseError } from "./gmail-watcher.js";
describe("gmail watcher", () => {
it("detects address already in use errors", () => {
expect(isAddressInUseError("listen tcp 127.0.0.1:8788: bind: address already in use")).toBe(
true,
);
expect(isAddressInUseError("EADDRINUSE: address already in use")).toBe(true);
expect(isAddressInUseError("some other error")).toBe(false);
});
});

View File

@@ -3,6 +3,7 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterAll, beforeEach, describe, expect, it, vi } from "vitest";
import { isAddressInUseError } from "./gmail-watcher.js";
const fixtureRoot = path.join(os.tmpdir(), `openclaw-hook-install-${randomUUID()}`);
let tempDirIndex = 0;
@@ -296,3 +297,13 @@ describe("installHooksFromNpmSpec", () => {
expect(result.error).toContain("unsupported npm spec");
});
});
describe("gmail watcher", () => {
it("detects address already in use errors", () => {
expect(isAddressInUseError("listen tcp 127.0.0.1:8788: bind: address already in use")).toBe(
true,
);
expect(isAddressInUseError("EADDRINUSE: address already in use")).toBe(true);
expect(isAddressInUseError("some other error")).toBe(false);
});
});