dist-mcp / mcp / chatContextBridge.test.js
import assert from "node:assert/strict";
import test from "node:test";
import { getActiveChatContext } from "../core-bundle.mjs";
import { bindChatContextToScratchpad } from "./chatContextBridge.js";
test("bindChatContextToScratchpad sets a numeric chatId and the scratchpad as workingDir", () => {
const scratchpadPath = "/tmp/example-scratchpad";
bindChatContextToScratchpad(scratchpadPath);
const active = getActiveChatContext();
assert.ok(active, "expected an active chat context to be set");
assert.match(active.chatId, /^\d+$/);
assert.equal(active.workingDir, scratchpadPath);
assert.match(active.requestId ?? "", /^bionic-/);
});
test("bindChatContextToScratchpad overwrites a previous binding", () => {
bindChatContextToScratchpad("/tmp/first-scratchpad");
bindChatContextToScratchpad("/tmp/second-scratchpad");
const active = getActiveChatContext();
assert.equal(active?.workingDir, "/tmp/second-scratchpad");
});
dist-mcp / mcp / chatContextBridge.test.js
import assert from "node:assert/strict";
import test from "node:test";
import { getActiveChatContext } from "../core-bundle.mjs";
import { bindChatContextToScratchpad } from "./chatContextBridge.js";
test("bindChatContextToScratchpad sets a numeric chatId and the scratchpad as workingDir", () => {
const scratchpadPath = "/tmp/example-scratchpad";
bindChatContextToScratchpad(scratchpadPath);
const active = getActiveChatContext();
assert.ok(active, "expected an active chat context to be set");
assert.match(active.chatId, /^\d+$/);
assert.equal(active.workingDir, scratchpadPath);
assert.match(active.requestId ?? "", /^bionic-/);
});
test("bindChatContextToScratchpad overwrites a previous binding", () => {
bindChatContextToScratchpad("/tmp/first-scratchpad");
bindChatContextToScratchpad("/tmp/second-scratchpad");
const active = getActiveChatContext();
assert.equal(active?.workingDir, "/tmp/second-scratchpad");
});