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

test(a02): assert unsafe Excel modes cannot delete master data

davoodmehraban89 committed Oct 31, 2026 at 00:36 UTC b8e2e8ebbbef4331116c60d4149ae9c88c679ca8
1 file changed +14
tests/ui-control-structure.test.mjs
+14
@@ -184,6 +184,20 @@ test('Q01: remaining financial grid, reporting and settings inputs announce thei
184 assert.ok(runner.includes('audit.fieldsMissingProgrammaticLabel <= 5'));
185 });
186
187 +test('A02: Excel imports reject destructive replacement before touching master data', () => {
188 + const controller=fs.readFileSync(path.join(root,'src','controllers','ExcelController.js'),'utf8');
189 + const settings=fs.readFileSync(path.join(root,'src','views','SettingsView.js'),'utf8');
190 + assert.equal((controller.match(/if \(mode !== 'merge'\)/g)||[]).length,2,
191 + 'both contact and product imports must fail closed');
192 + assert.doesNotMatch(controller,/if \(mode === 'replace'\)/,
193 + 'nontransactional delete-then-import must never be reachable');
194 + assert.doesNotMatch(settings,/<option value="replace"/);
195 + assert.match(settings,/window\.__importKind !== kind/);
196 + assert.match(settings,/data-excel-import-submit/);
197 + assert.doesNotMatch(settings,/_confirmImport\(\$\{JSON\.stringify\(kind\)/,
198 + 'untrusted filenames must never be embedded as executable inline HTML');
199 +});
200 +
201 test('Q01: Escape is handled once for nested financial dialogs and shortcut target is topmost', () => {
202 const shortcuts = fs.readFileSync(path.join(root,'src','core','KeyboardShortcuts.js'),'utf8');
203 const modal = fs.readFileSync(path.join(root,'src','core','Modal.js'),'utf8');