mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-13 09:23:17 +08:00
feat: add stable proactive delivery
This commit is contained in:
parent
410cb822d7
commit
31792d7bc8
88 changed files with 6427 additions and 488 deletions
|
|
@ -57,9 +57,11 @@ function configFixture(initial = [], events = []) {
|
|||
function runtimeFactory({ events = [], pendingByClient = new Map(), failStart = false } = {}) {
|
||||
const runtimes = [];
|
||||
const connectionTests = [];
|
||||
const proactiveSends = [];
|
||||
return {
|
||||
runtimes,
|
||||
connectionTests,
|
||||
proactiveSends,
|
||||
createRuntime: async ({ botId, config, clientSecret }) => {
|
||||
events.push(['create', botId]);
|
||||
let ready = false;
|
||||
|
|
@ -96,6 +98,10 @@ function runtimeFactory({ events = [], pendingByClient = new Map(), failStart =
|
|||
async sendConnectionTest(text) {
|
||||
connectionTests.push({ botId, text });
|
||||
},
|
||||
async sendProactiveText(...args) {
|
||||
proactiveSends.push({ botId, args });
|
||||
return { sent: true };
|
||||
},
|
||||
};
|
||||
runtimes.push(runtime);
|
||||
return runtime;
|
||||
|
|
@ -154,6 +160,14 @@ test('successful QR poll stores secret then config then starts runtime without p
|
|||
assert.equal(runtimes.connectionTests[0].botId, completed.botId);
|
||||
assert.match(runtimes.connectionTests[0].text, /DeepSeek Harness 连接测试成功/);
|
||||
assert.match(runtimes.connectionTests[0].text, /钉钉机器人(ding••••vate)/);
|
||||
const target = { kind: 'user', route: { userId: 'staff-one' } };
|
||||
assert.deepEqual(await controller.sendProactiveText(completed.botId, target, '主动投递'), {
|
||||
sent: true,
|
||||
});
|
||||
assert.deepEqual(runtimes.proactiveSends, [{
|
||||
botId: completed.botId,
|
||||
args: [target, '主动投递', {}],
|
||||
}]);
|
||||
await controller.close();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue