Versie 0.3.3
This commit is contained in:
1 parent
1cf6eeed29
commit
6e741a51fe
57 files changed
+1362
-2135
No files matched your search
@@ -1,4 +1,4 @@
|
||||
// Generated, do not edit. sha256:7bb4b4b51bf14bf2fa32107d316282a41f1c7586c33fc94c43098199bfa75953
|
||||
// Generated, do not edit. sha256:d705db22a94bcceb849648fab7596bd5a84e34d8b58a472ec9dc677c8db0cc0a
|
||||
import { describe, it, before, after } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { spawn } from 'node:child_process';
|
||||
@@ -11,7 +11,7 @@ import { fileURLToPath } from 'node:url';
|
||||
const WORTEL = join(fileURLToPath(import.meta.url), '..', '..', '..');
|
||||
const STDIO = join(WORTEL, 'server', 'mcp', 'stdio.mjs');
|
||||
|
||||
let dir, proc, buffer = '', wachtenden = [];
|
||||
let dir, dbPad, proc, buffer = '', wachtenden = [];
|
||||
|
||||
function stuur(bericht) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -24,10 +24,14 @@ function stuur(bericht) {
|
||||
|
||||
before(async () => {
|
||||
dir = await mkdtemp(join(tmpdir(), 'assetapp-mcp-stdio-'));
|
||||
proc = spawn(process.execPath, [STDIO], {
|
||||
env: { ...process.env, ASSETAPP_DATA_DIR: dir, ASSETAPP_DB_FILE: join(dir, 'db.sqlite') },
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
});
|
||||
dbPad = join(dir, 'MyAssets', 'db.sqlite');
|
||||
const env = { ...process.env, ASSETAPP_DATA_DIR: dir, ASSETAPP_DB_FILE: dbPad };
|
||||
const eerste = spawn(process.execPath, [STDIO], { env, stdio: 'ignore' });
|
||||
assert.equal(await new Promise((klaar) => eerste.once('exit', klaar)), 0, 'een verse installatie stopt met de koppeling uit');
|
||||
const db = new DatabaseSync(dbPad);
|
||||
db.exec(`UPDATE Preference SET value = '1' WHERE scope = 'ai' AND key = 'enabled'`);
|
||||
db.close();
|
||||
proc = spawn(process.execPath, [STDIO], { env, stdio: ['pipe', 'pipe', 'pipe'] });
|
||||
proc.stdout.on('data', (brok) => {
|
||||
buffer += brok.toString();
|
||||
let n;
|
||||
@@ -74,7 +78,7 @@ describe('mcp-stdio: het proces beantwoordt bericht na bericht', () => {
|
||||
|
||||
describe('mcp-stdio: de schuif "Actief" zet dit proces uit', () => {
|
||||
it('stopt bij het eerstvolgende bericht zodra de schuif uit gaat', async () => {
|
||||
const db = new DatabaseSync(join(dir, 'db.sqlite'));
|
||||
const db = new DatabaseSync(dbPad);
|
||||
db.exec(`PRAGMA busy_timeout = 5000`);
|
||||
db.exec(`INSERT INTO Preference (scope, key, value) VALUES ('ai', 'enabled', '0')
|
||||
ON CONFLICT (scope, key) DO UPDATE SET value = '0'`);
|
||||
|
||||
Reference in new issue
Block a user