mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-31 15:58:36 +00:00
* chore(lint): reduce underscore-dangle exceptions * chore(lint): reduce more underscore exceptions * chore(lint): remove underscore-dangle allow list * fix(lint): repair underscore cleanup regressions * test(lint): track version define suppression
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { beforeEach, describe, expect, it } from "vitest";
|
|
import { EMPTY_DISCORD_TEST_CONFIG } from "../test-support/config.js";
|
|
import {
|
|
testing as threadBindingsTesting,
|
|
createThreadBindingManager,
|
|
getThreadBindingManager,
|
|
} from "./thread-bindings.js";
|
|
|
|
type ThreadBindingsModule = {
|
|
getThreadBindingManager: typeof getThreadBindingManager;
|
|
};
|
|
|
|
async function loadThreadBindingsViaAlternateLoader(): Promise<ThreadBindingsModule> {
|
|
const fallbackPath = "./thread-bindings.ts?vitest-loader-fallback";
|
|
return (await import(/* @vite-ignore */ fallbackPath)) as ThreadBindingsModule;
|
|
}
|
|
|
|
describe("thread binding manager state", () => {
|
|
beforeEach(() => {
|
|
threadBindingsTesting.resetThreadBindingsForTests();
|
|
});
|
|
|
|
it("shares managers between ESM and alternate-loaded module instances", async () => {
|
|
const viaAlternateLoader = await loadThreadBindingsViaAlternateLoader();
|
|
|
|
createThreadBindingManager({
|
|
cfg: EMPTY_DISCORD_TEST_CONFIG,
|
|
accountId: "work",
|
|
persist: false,
|
|
enableSweeper: false,
|
|
});
|
|
|
|
const direct = getThreadBindingManager("work");
|
|
if (!direct) {
|
|
throw new Error("expected direct thread binding manager");
|
|
}
|
|
expect(viaAlternateLoader.getThreadBindingManager("work")).toBe(direct);
|
|
});
|
|
});
|