سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 18:15 UTC
test: guard organization sync against bypassing optimistic concurrency (#216)
davoodmehraban89 committed
Nov 18, 2026 at 17:34 UTC
3395adfa7c57f5cb6a47ea681719d9d791589821
1 file changed
+8
scripts/organization-sync-version-contract.mjs
new
+8
@@ -0,0 +1,8 @@
1
+import fs from 'node:fs';
2
+import assert from 'node:assert/strict';
3
+const source=fs.readFileSync('js/organization-rbac.js','utf8');
4
+assert.doesNotMatch(source,/runSync\s*=\s*async\s*function/,'organization layer must not override version-aware runSync');
5
+assert.match(source,/syncVersionSnap\.clear\(\)/,'organization pull must reset version snapshot');
6
+assert.match(source,/snapVersions\.forEach\(\(v,k\)=>syncVersionSnap\.set\(k,v\)\)/,'organization pull must restore server versions');
7
+assert.match(source,/FINORA_SERVER_VERSION_MISSING/,'organization pull must reject rows without valid server version');
8
+console.log('organization sync preserves optimistic concurrency and server version snapshots');