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

test(A07): verify local Excel roundtrip and no startup CDN

davoodmehraban89 committed Oct 15, 2026 at 20:42 UTC 8b5635e55f38c4d3fac6281c6d72b3474ed82e46
1 file changed +28
tests/a07-offline-bundled-assets.test.mjs new
+28
@@ -0,0 +1,28 @@
1 +import test from 'node:test';
2 +import assert from 'node:assert/strict';
3 +import { readFileSync } from 'node:fs';
4 +import * as XLSX from 'xlsx';
5 +
6 +const read = path => readFileSync(new URL('../' + path, import.meta.url), 'utf8');
7 +
8 +test('A07: the app shell cannot block startup on a remote CDN', () => {
9 + const html = read('index.html');
10 + const entry = read('src/main.js');
11 + const excel = read('src/controllers/ExcelController.js');
12 + assert.doesNotMatch(html, /<script[^>]*src=["']https?:\/\//i);
13 + assert.doesNotMatch(html, /<link[^>]*href=["']https?:\/\//i);
14 + assert.match(entry, /@fontsource\/vazirmatn\/400\.css/);
15 + assert.match(entry, /@fontsource\/vazirmatn\/700\.css/);
16 + assert.match(excel, /import \* as XLSX from 'xlsx'/);
17 +});
18 +
19 +test('A07: bundled SheetJS can read and write Persian spreadsheets with integer currency', () => {
20 + const sheet = XLSX.utils.aoa_to_sheet([['کالا','مبلغ'],['دفتر',125000]]);
21 + const wb = XLSX.utils.book_new();
22 + XLSX.utils.book_append_sheet(wb, sheet, 'اطلاعات');
23 + const array = XLSX.write(wb, { bookType:'xlsx', type:'buffer' });
24 + assert.ok(array.byteLength > 200);
25 + const restored = XLSX.read(array, { type:'buffer' });
26 + const rows = XLSX.utils.sheet_to_json(restored.Sheets['اطلاعات'], { header: 1 });
27 + assert.deepEqual(rows, [['کالا','مبلغ'],['دفتر',125000]]);
28 +});