mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 03:03:24 +08:00
feat: send test messages during bot connection checks
This commit is contained in:
parent
94da24538f
commit
fb61c4235f
78 changed files with 3460 additions and 210 deletions
|
|
@ -12,6 +12,10 @@ import {
|
|||
observeBotWorkspaceRemovals,
|
||||
validateWorkspacePath,
|
||||
} from '../src/channels/shared/bot-workspace-store.mjs';
|
||||
import {
|
||||
connectionTestTarget,
|
||||
rememberConnectionTestTarget,
|
||||
} from '../src/channels/shared/connection-test.mjs';
|
||||
import {
|
||||
runWorkspaceCommand,
|
||||
splitWorkspaceCommandMessage,
|
||||
|
|
@ -70,6 +74,23 @@ test('BotWorkspaceStore uses process.cwd() when a bot has no configured workspac
|
|||
assert.equal(await store.ensure('bot_cwd'), process.cwd());
|
||||
});
|
||||
|
||||
test('connection test targets survive a new workspace scope for the same bot', async (t) => {
|
||||
const { path, defaultWorkspace } = await fixture(t);
|
||||
const workspaces = await new BotWorkspaceStore(path, { defaultWorkspace }).load();
|
||||
await workspaces.ensure('bot_reconnect');
|
||||
const state = {};
|
||||
const harness = {};
|
||||
const beforeReconnect = createBotWorkspaceScope(harness, {
|
||||
botId: 'bot_reconnect', workspaces, state,
|
||||
});
|
||||
const afterReconnect = createBotWorkspaceScope(harness, {
|
||||
botId: 'bot_reconnect', workspaces, state,
|
||||
});
|
||||
|
||||
assert.equal(rememberConnectionTestTarget(beforeReconnect.state, { channelId: 'D123' }), true);
|
||||
assert.deepEqual(connectionTestTarget(afterReconnect.state), { channelId: 'D123' });
|
||||
});
|
||||
|
||||
test('workspace writes roll back updates while committed removals stay retired in memory', async (t) => {
|
||||
const { root, defaultWorkspace, alternateWorkspace } = await fixture(t);
|
||||
const storeDirectory = join(root, 'workspace-store');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue