فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(holoo): opt in to Aram SQL integration checks

Davood Mehraban committed Nov 22, 2026 at 21:06 UTC c54c245c4b5e093213bee9aea33b2356aac57662
2 files changed +8 -3
tests/holoo-direct-sql-readiness.test.mjs
+5 -2
@@ -2,9 +2,11 @@
2 import assert from 'node:assert/strict';
3 import { readFileSync } from 'node:fs';
4 import { spawnSync } from 'node:child_process';
5 +import { fileURLToPath } from 'node:url';
6 const scriptPath = new URL('../scripts/holoo-direct-sql-readiness.ps1', import.meta.url);
7 const script = readFileSync(scriptPath, 'utf8');
7 -const run = (...args) => spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File', scriptPath.pathname.replace(/^\/(?=[A-Za-z]:)/, ''), '-Json', ...args], { encoding: 'utf8', timeout: 15000 });
8 +const onApprovedLab = process.platform === 'win32' && process.env.HOLOO_SQL_INTEGRATION === '1';
9 +const run = (...args) => spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File', fileURLToPath(scriptPath), '-Json', ...args], { encoding: 'utf8', timeout: 15000 });
10 test('preflight contains only read-only SQL and no VM dependency', () => {
11 assert.match(script, /Database -ne/);
12 assert.match(script, /Server -ne/);
@@ -31,10 +33,11 @@ test('rejects similarly named lab database before opening a connection', {skip:
33 assert.equal(result.status, 2, result.stderr);
34 assert.deepEqual(JSON.parse(result.stdout).checks.map(c => c.name), ['database-selection']);
35 });
34 -test('verified lab database is accessible in direct SQL mode', {skip: process.platform !== 'win32'}, () => {
36 +test('verified lab database is accessible in direct SQL mode', {skip: !onApprovedLab}, () => {
37 const result = run();
38 assert.equal(result.status, 0, result.stderr);
39 const json = JSON.parse(result.stdout);
40 assert.equal(json.readyForLabSql, true);
41 assert.deepEqual(json.checks.map(c => c.status), ['PASS', 'PASS', 'PASS']);
42 });
43 +
tests/holoo-schema-audit.test.mjs
+3 -1
@@ -5,6 +5,7 @@ import { fileURLToPath } from 'node:url';
5 import { spawnSync } from 'node:child_process';
6 const path = fileURLToPath(new URL('../scripts/holoo-schema-audit.ps1', import.meta.url));
7 const script = readFileSync(path, 'utf8');
8 +const onApprovedLab = process.platform === 'win32' && process.env.HOLOO_SQL_INTEGRATION === '1';
9 test('schema audit uses approved preflight and read-only catalog queries', () => {
10 assert.match(script, /holoo-direct-sql-readiness\.ps1/);
11 assert.match(script, /sys\.foreign_keys/);
@@ -13,7 +14,7 @@ test('schema audit uses approved preflight and read-only catalog queries', () =>
14 assert.match(script, /sys\.triggers/);
15 assert.doesNotMatch(script, /\b(?:INSERT\s+INTO|UPDATE\s+\w+\s+SET|DELETE\s+FROM|DROP\s+DATABASE|ALTER\s+DATABASE)\b/i);
16 });
16 -test('real lab structural audit returns three complete primary-keyed tables', {skip: process.platform !== 'win32'}, () => {
17 +test('real lab structural audit returns three complete primary-keyed tables', {skip: !onApprovedLab}, () => {
18 const result = spawnSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File', path, '-Json'], {encoding:'utf8', timeout:30000});
19 assert.equal(result.status, 0, result.stderr);
20 const audit = JSON.parse(result.stdout);
@@ -35,3 +36,4 @@ test('real lab structural audit returns three complete primary-keyed tables', {s
36
37
38
39 +