Files
memind/mindspace-local-runtime-services.test.mjs
2026-07-27 15:34:35 +08:00

72 lines
2.2 KiB
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { createMindSpaceLocalRuntimeServices } from './mindspace-local-runtime-services.mjs';
test('createMindSpaceLocalRuntimeServices assembles local runtime-backed service bindings', () => {
const pool = {
query: async () => {
throw new Error('not implemented in unit test');
},
};
const services = createMindSpaceLocalRuntimeServices({
pool,
h5Root: '/tmp/h5',
env: {
MINDSPACE_STORAGE_ROOT: '/srv/mindspace-data',
H5_PUBLIC_BASE_URL: 'https://example.com',
},
maxFileBytes: 8192,
publicPageLimit: 8,
resolveUserIdForAgentSession: async () => 'user-1',
resolveWorkspaceRoot: async () => '/tmp/workspace',
conversationPackageBackfill: () => [],
conversationPackagePublicHtmlHydrator: () => [],
logger: { info() {}, warn() {}, error() {} },
});
assert.equal(services.storageRoot, '/srv/mindspace-data');
assert.equal(services.publicBaseUrl, 'https://example.com');
assert.equal(services.storageAdapter.kind, 'local-fs');
assert.ok(services.serviceFacade);
assert.ok(services.conversationPackageRegistry);
assert.ok(services.assetService);
assert.ok(services.pageService);
assert.ok(services.pageSyncService);
assert.ok(services.chatSaveService);
assert.ok(services.conversationArtifactService);
assert.ok(services.publicFinishService);
assert.equal(
typeof services.publicFinishService
.prepareWechatHtmlDelivery,
'function',
);
assert.equal(
typeof services.publicFinishService
.ensureWechatFreshPageThumbnails,
'function',
);
assert.ok(
services
.workspacePublicationDeliveryService,
);
assert.ok(
services.workspacePageDeliveryService,
);
assert.ok(services.workspaceToolService);
assert.equal(
typeof services.workspaceToolService
.writeBinaryFile,
'function',
);
assert.equal(
typeof services.workspaceToolService
.generateLongImage,
'function',
);
assert.ok(services.publicationService);
assert.ok(services.cleanupService);
assert.ok(services.agentJobService);
assert.ok(services.pageLiveEditService);
assert.ok(services.assetAgentService);
});