mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-11 06:33:17 +08:00
fix(weixin): align long-reply limits across runtime
This commit is contained in:
parent
868372fb04
commit
5e07137c44
7 changed files with 178 additions and 165 deletions
|
|
@ -63,6 +63,8 @@ test('Weixin production has no per-bot result-file Gate', async (t) => {
|
|||
|
||||
assert.equal(Object.hasOwn(runtimes[0], 'outboundArtifactsEnabled'), false);
|
||||
assert.equal(Object.hasOwn(runtimes[1], 'outboundArtifactsEnabled'), false);
|
||||
assert.equal(runtimes[0].maxMessageChars, 1_800);
|
||||
assert.equal(runtimes[1].maxMessageChars, 1_800);
|
||||
await production.close();
|
||||
|
||||
const productionWithDefault = await createProductionController(ctx, { dataDir }, internals);
|
||||
|
|
@ -72,5 +74,6 @@ test('Weixin production has no per-bot result-file Gate', async (t) => {
|
|||
token: 'host-only',
|
||||
});
|
||||
assert.equal(Object.hasOwn(runtimes[2], 'outboundArtifactsEnabled'), false);
|
||||
assert.equal(runtimes[2].maxMessageChars, 1_800);
|
||||
await productionWithDefault.close();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ test('runtime verifies the token, consumes getUpdates, replies, persists cursor,
|
|||
const calls = [];
|
||||
let pollCount = 0;
|
||||
let askSignal;
|
||||
const answer = '答'.repeat(2_000);
|
||||
const stateData = { cursor: '', seen: new Set(), session: null };
|
||||
const api = {
|
||||
notifyStart: async (request) => calls.push(['start', request.token]),
|
||||
|
|
@ -133,7 +134,7 @@ test('runtime verifies the token, consumes getUpdates, replies, persists cursor,
|
|||
createSession: async () => 'session-1',
|
||||
ask: async (_sessionId, _text, options) => {
|
||||
askSignal = options.signal;
|
||||
return '回答';
|
||||
return answer;
|
||||
},
|
||||
},
|
||||
state,
|
||||
|
|
@ -145,10 +146,14 @@ test('runtime verifies the token, consumes getUpdates, replies, persists cursor,
|
|||
await flush();
|
||||
await flush();
|
||||
assert.equal(stateData.cursor, 'cursor-next');
|
||||
assert.deepEqual(calls.slice(0, 2), [
|
||||
['start', 'bot-token'],
|
||||
['send', '回答', 'context-7'],
|
||||
assert.equal(calls[0][0], 'start');
|
||||
assert.deepEqual(calls.slice(1, 3).map((call) => call[1].length), [1_800, 200]);
|
||||
assert.equal(calls.slice(1, 3).map((call) => call[1]).join(''), answer);
|
||||
assert.deepEqual(calls.slice(1, 3).map((call) => call[2]), [
|
||||
'context-7',
|
||||
'context-7',
|
||||
]);
|
||||
assert.equal(runtime.status.messagesReplied, 1);
|
||||
assert.equal(askSignal.aborted, false);
|
||||
await runtime.stop();
|
||||
assert.equal(askSignal.aborted, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue