42 lines
1.7 KiB
JavaScript
42 lines
1.7 KiB
JavaScript
// Generated, do not edit. sha256:3d2d04d4ac960f13ff53733a351f56fc7a4b8b944d9779af9fcc16cb1046a33f
|
|
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { existsSync } from 'node:fs';
|
|
import { isAbsolute } from 'node:path';
|
|
|
|
import { mcpClientConfig } from '../../server/mcp/client-config.mjs';
|
|
import { CONFIG } from '../../shared/config.js';
|
|
|
|
describe('mcpClientConfig', () => {
|
|
it('wijst naar een stdio.mjs dat echt bestaat', () => {
|
|
const { path } = mcpClientConfig();
|
|
assert.ok(isAbsolute(path), `pad moet absoluut zijn, was: ${path}`);
|
|
assert.ok(existsSync(path), `pad bestaat niet: ${path}`);
|
|
assert.match(path, /stdio\.mjs$/);
|
|
});
|
|
|
|
it('gebruikt de servernaam uit CONFIG als sleutel', () => {
|
|
const { serverKey, snippet } = mcpClientConfig();
|
|
assert.equal(serverKey, CONFIG.AI.SERVER_NAME);
|
|
assert.ok(Object.hasOwn(JSON.parse(snippet).mcpServers, CONFIG.AI.SERVER_NAME));
|
|
});
|
|
|
|
it('start met node en niet met npm', () => {
|
|
const { snippet, serverKey } = mcpClientConfig();
|
|
assert.equal(JSON.parse(snippet).mcpServers[serverKey].command, 'node');
|
|
});
|
|
|
|
it('levert geldige JSON waar het pad ongeschonden uit terugkomt', () => {
|
|
const { snippet, serverKey, path } = mcpClientConfig();
|
|
const terug = JSON.parse(snippet);
|
|
assert.deepEqual(terug.mcpServers[serverKey].args, [path]);
|
|
});
|
|
|
|
it('bevat een pad met ontdubbelde backslashes zodra er backslashes in zitten', () => {
|
|
const { snippet, path } = mcpClientConfig();
|
|
if (!path.includes('\\')) return;
|
|
assert.ok(snippet.includes('\\\\'), 'backslashes horen in de JSON-tekst ontdubbeld te staan');
|
|
assert.ok(!/[^\\]\\[^\\]/.test(snippet), 'er staat een enkele backslash in de JSON-tekst');
|
|
});
|
|
});
|