11 lines
2.9 KiB
JavaScript
11 lines
2.9 KiB
JavaScript
import fs from 'node:fs';import assert from 'node:assert/strict';import {session} from './sgf-single-http.mjs';
|
|
const run=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json')),root=run.root+'/private/receipt-composition-cc50a276c10c';const old=JSON.parse(fs.readFileSync(root+'/single-financial-http-progress.json')),checks=[];const s=await session('sgf:accounting_prepare','accounting');
|
|
for(const path of ['/general-ledger','/general-ledger/workspace','/api/general-ledger/sales?invoice_id=1','/api/general-ledger/costs?order_id=1','/api/general-ledger/industrial?lot_id=1','/api/catalogue-accounting']){const r=await s.get(path);const body=await r.text();assert.equal(r.status,200,path+': '+body.slice(0,120));if(path.includes('/sales?'))assert.equal(JSON.parse(body).journals.length,4);if(path.includes('/costs?')||path.includes('/industrial?'))assert.equal(JSON.parse(body).journals.length,3);checks.push(path+' reads qualified shared book');}
|
|
let r=await s.get('/api/general-ledger?account_q=QA-STOCK&accounts_per_page=100');assert.equal(r.status,200);let data=await r.json();assert.equal(data.chart_accounts.length,1);assert.equal(data.chart_accounts[0].code,'QA-STOCK');checks.push('native chart exposes exact stock account with bounded search');const id=data.chart_accounts[0].id;
|
|
r=await s.get('/general-ledger/account-ledger?from_on=2026-01-01&to_on=2026-12-31&account_id='+id);assert.equal(r.status,200);const html=await r.text();assert(html.includes('QA-STOCK'));checks.push('chart account opens actual account ledger');
|
|
r=await s.get('/api/general-ledger?account_q=%25');assert.equal(r.status,200);data=await r.json();assert.equal(data.chart_accounts.length,0);checks.push('chart wildcard is literal rather than an unrestricted search');
|
|
for(const [url,expected]of [['/api/general-ledger/receipts/'+old.operations['sale1000-post'].key,old.operations['sale1000-post'].result.journal_id],['/api/general-ledger/financial-receipts/settlement/'+old.operations.payment20.key,old.operations.payment20.result.payment_id]]){r=await s.get(url);assert.equal(r.status,200);data=await r.json();assert(JSON.stringify(data).includes(String(expected)));checks.push('legacy receipt reads its existing native command without executing it');}
|
|
r=await s.get('/general-ledger/flow?source=2');assert.equal(r.status,302);assert(r.headers.get('location').includes('obligation_id=2'));await r.text();checks.push('supplier source retains qualified obligation in common journal continuation');
|
|
r=await s.get('/api/general-ledger/sales?invoice_id=999999');assert.equal(r.status,403);await r.text();checks.push('unknown sales source is refused without falling back to another invoice');
|
|
const proof=root+'/accounting-continuity-http-20261110.json';fs.writeFileSync(proof,JSON.stringify({passed:true,checks,new_business_commands:0,browser_visual_review:false},null,2));console.log(JSON.stringify({passed:true,checks:checks.length,proof}));
|