mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
test(matrix): isolate approval reaction runtime (#105251)
This commit is contained in:
committed by
GitHub
parent
1bea458124
commit
7a4cfa3764
@@ -1,5 +1,5 @@
|
||||
// Matrix tests cover approval reactions plugin behavior.
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
buildMatrixApprovalReactionHint,
|
||||
clearMatrixApprovalReactionTargetsForTest,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
resolveMatrixApprovalReactionTargetWithPersistence as resolveMatrixApprovalReactionTargetWithPersistenceRaw,
|
||||
unregisterMatrixApprovalReactionTarget as unregisterMatrixApprovalReactionTargetRaw,
|
||||
} from "./approval-reactions.js";
|
||||
import { setMatrixRuntime } from "./runtime.js";
|
||||
import { clearMatrixRuntime, setMatrixRuntime } from "./runtime.js";
|
||||
|
||||
type RegisterTargetParams = Parameters<typeof registerMatrixApprovalReactionTargetRaw>[0];
|
||||
type ResolveTargetParams = Parameters<
|
||||
@@ -53,8 +53,13 @@ function createRuntimeLogger(overrides: { warn?: ReturnType<typeof vi.fn> } = {}
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
clearMatrixRuntime();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
clearMatrixApprovalReactionTargetsForTest();
|
||||
clearMatrixRuntime();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { PluginRuntime } from "./runtime-api.js";
|
||||
|
||||
const {
|
||||
setRuntime: setMatrixRuntime,
|
||||
clearRuntime: clearMatrixRuntime,
|
||||
getRuntime: getMatrixRuntime,
|
||||
tryGetRuntime: getOptionalMatrixRuntime,
|
||||
} = createPluginRuntimeStore<PluginRuntime>({
|
||||
@@ -11,4 +12,4 @@ const {
|
||||
errorMessage: "Matrix runtime not initialized",
|
||||
});
|
||||
|
||||
export { getMatrixRuntime, getOptionalMatrixRuntime, setMatrixRuntime };
|
||||
export { clearMatrixRuntime, getMatrixRuntime, getOptionalMatrixRuntime, setMatrixRuntime };
|
||||
|
||||
Reference in New Issue
Block a user