88import { createDeferred } from "openclaw/plugin-sdk/extension-shared" ;
99import { createPluginRuntimeMock } from "openclaw/plugin-sdk/plugin-test-runtime" ;
1010import { 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.
1113import "./monitor.send.test-mocks.js" ;
1214import "./zalo-js.test-mocks.js" ;
1315import "./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+
4050describe ( "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