mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-16 05:23:21 +08:00
fix: remember direct recipients for connection tests
This commit is contained in:
parent
fb61c4235f
commit
3ac70a7c65
34 changed files with 397 additions and 178 deletions
|
|
@ -127,5 +127,7 @@ test('Weixin connection feedback is scoped to the checked bot', async (t) => {
|
|||
test('Weixin reconnect failure uses fixed translatable copy', async () => {
|
||||
const source = await readFile(CLIENT_URL, 'utf8');
|
||||
assert.match(source, /'连接检查失败,请稍后重试。'/);
|
||||
assert.match(source, /'连接检查完成。机器人尚未收到可用于测试的私聊消息。'/);
|
||||
assert.doesNotMatch(source, /请先私聊机器人发送 \/status/);
|
||||
assert.doesNotMatch(source, /连接检查失败:\$\{presentError\(error\)\.message\}/);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ const PNG_BYTES = Buffer.from([
|
|||
0x01, 0x02, 0x03,
|
||||
]);
|
||||
|
||||
test('Weixin remembers only the authorized owner /status as a connection-test target', async () => {
|
||||
test('Weixin remembers any authorized private inbound as a connection-test target', async () => {
|
||||
const fixture = stateFixture();
|
||||
const sent = [];
|
||||
const bridge = new WeixinHarnessBridge({
|
||||
|
|
@ -81,20 +81,20 @@ test('Weixin remembers only the authorized owner /status as a connection-test ta
|
|||
state: fixture.state,
|
||||
});
|
||||
|
||||
await bridge.accept(message('status-owner', '/status'));
|
||||
await bridge.accept(message('help-owner', '/help'));
|
||||
assert.deepEqual(connectionTestTarget(fixture.state), { toUserId: 'owner-user' });
|
||||
assert.equal(sent.at(-1).text, '微信与 DeepSeek Harness 连接正常。');
|
||||
assert.match(sent.at(-1).text, /\/help/);
|
||||
|
||||
const rejectedFixture = stateFixture();
|
||||
const rejectedBridge = new WeixinHarnessBridge({
|
||||
api: { sendText: async () => assert.fail('unauthorized status must not be answered') },
|
||||
api: { sendText: async () => assert.fail('unauthorized message must not be answered') },
|
||||
baseUrl: 'https://ilinkai.weixin.qq.com/',
|
||||
token: 'host-token',
|
||||
ownerUserId: 'owner-user',
|
||||
harness: { ensureRunning: async () => true },
|
||||
state: rejectedFixture.state,
|
||||
});
|
||||
await rejectedBridge.accept(message('status-other', '/status', { from_user_id: 'other-user' }));
|
||||
await rejectedBridge.accept(message('help-other', '/help', { from_user_id: 'other-user' }));
|
||||
assert.equal(connectionTestTarget(rejectedFixture.state), null);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue