فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
fix(a08): keep injected stability script browser-only and test it
Davood Mehraban committed
Nov 23, 2026 at 22:52 UTC
a6c54cdc36bd7e29153a582424c8f30e85825971
2 files changed
+30
-4
tests/windows-vm-native-memory-stability-browser.js
-4
@@ -1,8 +1,4 @@
1
'use strict';
2
-const assert = require('node:assert/strict');
3
-const fs = require('node:fs');
4
-const path = require('node:path');
5
-const { spawn, execFileSync } = require('node:child_process');
2
// This script is evaluated by CDP inside the installed Tauri/WebView2 renderer.
3
// It does not seed data; the standard A08 benchmark must run first.
4
(async () => {
tests/windows-vm-native-memory-stability-contract.test.cjs
new
+30
@@ -0,0 +1,30 @@
1
+'use strict';
2
+const { test } = require('node:test');
3
+const assert = require('node:assert/strict');
4
+const fs = require('node:fs');
5
+const vm = require('node:vm');
6
+const path = require('node:path');
7
+
8
+test('native stability script is browser-compatible and checks 10k/50k cycles', async () => {
9
+ const source = fs.readFileSync(path.join(__dirname,
10
+ 'windows-vm-native-memory-stability-browser.js'), 'utf8');
11
+ assert.doesNotMatch(source, /\brequire\s*\(/);
12
+ assert.doesNotMatch(source, /\bprocess\./);
13
+ const store = {
14
+ count: async name => ({ products: 10000, invoices: 50000 })[name],
15
+ getByCompany: async () => Array(50000).fill(null)
16
+ };
17
+ const region = { querySelectorAll: () => Array(100).fill(null) };
18
+ const context = {
19
+ FINORA: { Storage: store, Company: { current: async () => ({ id: 'synthetic' }) },
20
+ Router: { go: async () => {} } },
21
+ __TAURI_INTERNALS__: { invoke: () => {} },
22
+ window: { ReportsView: { _switchTab: () => {}, _setProductsPage: () => {} } },
23
+ document: { getElementById: () => region },
24
+ performance: { now: () => 1 }
25
+ };
26
+ const result = await vm.runInNewContext(source, context, { timeout: 3000 });
27
+ assert.equal(result.rounds.length, 1);
28
+ assert.equal(result.products, 10000);
29
+ assert.equal(result.invoices, 50000);
30
+});