mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-17 04:50:45 +08:00
feat: add native result-file delivery
This commit is contained in:
parent
2803bbcbab
commit
d472dd5a75
65 changed files with 10205 additions and 255 deletions
72
test/channels/qq/production.test.mjs
Normal file
72
test/channels/qq/production.test.mjs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import { mkdtemp, rm } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
import { createProductionController } from '../../../plugin-src/host/channels/qq/production.mjs';
|
||||
|
||||
test('QQ production has no per-bot result-file Gate', async (t) => {
|
||||
const dataDir = await mkdtemp(join(tmpdir(), 'dsh-qq-production-artifacts-'));
|
||||
t.after(() => rm(dataDir, { recursive: true, force: true }));
|
||||
const runtimes = [];
|
||||
let controllerOptions;
|
||||
|
||||
class ConfigStore {
|
||||
async load() { return this; }
|
||||
list() { return []; }
|
||||
}
|
||||
class StateStore {
|
||||
async load() { return this; }
|
||||
}
|
||||
class Harness {
|
||||
stopManagedProcess() {}
|
||||
}
|
||||
class Runtime {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
runtimes.push(options);
|
||||
}
|
||||
}
|
||||
class Controller {
|
||||
constructor(options) {
|
||||
controllerOptions = options;
|
||||
}
|
||||
async close() {}
|
||||
}
|
||||
class QrAuth {}
|
||||
const supervisor = {
|
||||
ready: Promise.resolve(),
|
||||
start() { return this; },
|
||||
async close() {},
|
||||
};
|
||||
|
||||
const production = await createProductionController({
|
||||
credentials: {},
|
||||
webServer: { port: 3080 },
|
||||
logger: () => ({ error() {}, warn() {}, info() {}, debug() {} }),
|
||||
}, { dataDir }, {
|
||||
ConfigStore,
|
||||
StateStore,
|
||||
HarnessClient: Harness,
|
||||
Controller,
|
||||
Runtime,
|
||||
QrAuth,
|
||||
createConnectionSupervisor: () => supervisor,
|
||||
});
|
||||
|
||||
await controllerOptions.createRuntime({
|
||||
botId: 'qq_enabled',
|
||||
config: { botId: 'qq_enabled', appId: 'app-enabled' },
|
||||
appSecret: 'host-only',
|
||||
});
|
||||
await controllerOptions.createRuntime({
|
||||
botId: 'qq_disabled',
|
||||
config: { botId: 'qq_disabled', appId: 'app-disabled' },
|
||||
appSecret: 'host-only',
|
||||
});
|
||||
|
||||
assert.equal(Object.hasOwn(runtimes[0], 'outboundArtifactsEnabled'), false);
|
||||
assert.equal(Object.hasOwn(runtimes[1], 'outboundArtifactsEnabled'), false);
|
||||
await production.close();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue