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

test(a08): keep 50k invoice fixture inside current report window

Davood Mehraban committed Nov 23, 2026 at 18:23 UTC 6dffe04c8e594167b2c96feb47d67b5998d469ac
1 file changed +11 -1
tests/windows-vm-native-performance-browser.js
+11 -1
@@ -10,6 +10,16 @@
10 }
11 const productCount = 10000;
12 const invoiceCount = 50000;
13 + // The reports route defaults to the most recent 30 days. A hard-coded
14 + // historical seed date silently makes the 50k invoices invisible as time
15 + // advances, so derive a current Jalali date for the disposable fixture.
16 + const dateParts = new Intl.DateTimeFormat('en-US-u-ca-persian', {
17 + year:'numeric',month:'2-digit',day:'2-digit'
18 + }).formatToParts(new Date());
19 + const datePart = type => dateParts.find(part=>part.type===type)?.value;
20 + const benchmarkDate = [datePart('year'),datePart('month'),datePart('day')].join('/');
21 + if (!/^\d{4}\/\d{2}\/\d{2}$/.test(benchmarkDate))
22 + throw Error('Native A08 could not derive a current Jalali fixture date');
23 const t = fn => performance.now();
24 const duration = async work => {
25 const start = performance.now();
@@ -42,7 +52,7 @@
52 const productId = 'vm-a08-product-' + productIndex;
53 return {
54 id: 'vm-a08-invoice-' + i, companyId: company.id, ownerUserId: user.id,
45 - number: String(i + 1), date: '1405/07/18', kind: 'sale',
55 + number: String(i + 1), date: benchmarkDate, kind: 'sale',
56 contactId: 'vm-a08-contact', contactName: 'VM synthetic benchmark customer',
57 isPreInvoice: false, financePosted: false,
58 subtotal: price, totalDiscount: 0, vatAmount: 0,