Skip to content

Commit e49cbc2

Browse files
committed
test(zalouser): document lifecycle mock boundary
1 parent 08eb34a commit e49cbc2

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

‎extensions/zalouser/src/channel.lifecycle.test.ts‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
99
import { createPluginRuntimeMock } from "openclaw/plugin-sdk/plugin-test-runtime";
1010
import { beforeEach, describe, expect, it, vi } from "vitest";
11+
// Register the SDK boundary mocks before preloading lazy production modules;
12+
// reversing this order reaches the real credential store and Zalo client.
1113
import "./monitor.send.test-mocks.js";
1214
import "./zalo-js.test-mocks.js";
1315
import "./channel.runtime.js";
@@ -37,6 +39,14 @@ function createAccount(config: ResolvedZalouserAccount["config"] = {}): Resolved
3739
};
3840
}
3941

42+
function createNameMatchedAccount(): ResolvedZalouserAccount {
43+
return createAccount({
44+
dangerouslyAllowNameMatching: true,
45+
dmPolicy: "allowlist",
46+
allowFrom: ["Alice"],
47+
});
48+
}
49+
4050
describe("zalouser gateway lifecycle", () => {
4151
beforeEach(() => {
4252
vi.clearAllMocks();
@@ -78,11 +88,7 @@ describe("zalouser gateway lifecycle", () => {
7888

7989
const task = requireStartAccount()(
8090
createStartAccountContext({
81-
account: createAccount({
82-
dangerouslyAllowNameMatching: true,
83-
dmPolicy: "allowlist",
84-
allowFrom: ["Alice"],
85-
}),
91+
account: createNameMatchedAccount(),
8692
abortSignal: abort.signal,
8793
}),
8894
);
@@ -107,11 +113,7 @@ describe("zalouser gateway lifecycle", () => {
107113

108114
await requireStartAccount()(
109115
createStartAccountContext({
110-
account: createAccount({
111-
dangerouslyAllowNameMatching: true,
112-
dmPolicy: "allowlist",
113-
allowFrom: ["Alice"],
114-
}),
116+
account: createNameMatchedAccount(),
115117
abortSignal: abort.signal,
116118
}),
117119
);

0 commit comments

Comments
 (0)