Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]
import fs from "node:fs";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { createTestPluginApi } from "../../test/helpers/plugins/plugin-api.js";
const { tokenjuiceFactory, createTokenjuiceOpenClawEmbeddedExtension } = vi.hoisted(() => {
const tokenjuiceFactory = vi.fn();
const createTokenjuiceOpenClawEmbeddedExtension = vi.fn(() => tokenjuiceFactory);
return {
tokenjuiceFactory,
createTokenjuiceOpenClawEmbeddedExtension,
};
});
vi.mock("./runtime-api.js", () => ({
createTokenjuiceOpenClawEmbeddedExtension,
}));
import plugin from "./index.js";
describe("tokenjuice bundled plugin", () => {
beforeEach(() => {
createTokenjuiceOpenClawEmbeddedExtension.mockClear();
tokenjuiceFactory.mockClear();
});
it("is opt-in by default", () => {
const manifest = JSON.parse(
fs.readFileSync(new URL("./openclaw.plugin.json", import.meta.url), "utf8"),
) as { enabledByDefault?: unknown };
expect(manifest.enabledByDefault).toBeUndefined();
});
it("registers tokenjuice tool result middleware for Pi and Codex runtimes", () => {
const registerAgentToolResultMiddleware = vi.fn();
plugin.register(
createTestPluginApi({
id: "tokenjuice",
name: "tokenjuice",
source: "test",
config: {},
pluginConfig: {},
runtime: {} as never,
registerAgentToolResultMiddleware,
}),
);
expect(createTokenjuiceOpenClawEmbeddedExtension).toHaveBeenCalledTimes(1);
expect(tokenjuiceFactory).toHaveBeenCalledTimes(1);
expect(registerAgentToolResultMiddleware).toHaveBeenCalledWith(expect.any(Function), {
runtimes: ["pi", "codex"],
});
});
});
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-04-27)
¤
*© Formatika GbR, Deutschland