سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 08:00 UTC
test: opt synthetic deferred posting cases into enforce explicitly
davoodmehraban89 committed
Oct 16, 2026 at 16:48 UTC
e5f069aa155f8aa71eb34730c41188e483d550b5
1 file changed
+1
-1
scripts/phase1a-deferred-posting-test.mjs
+1
-1
@@ -8,7 +8,7 @@ function rec(coll,id,data){
8
return "INSERT INTO public.records(organization_id,owner_id,collection,id,data) VALUES("+org+",'"+UID+"','"+coll+"','"+id+"','"+JSON.stringify(data).replace(/'/g,"''")+"'::jsonb);";
9
}
10
const meta={companyId:'TEST',fiscalYearId:'FY',date:'1405/07/24',number:'100',status:'draft'};
11
-const setup="BEGIN; INSERT INTO auth.users(id,instance_id,aud,role,email,email_confirmed_at,raw_user_meta_data) VALUES('"+UID+"','00000000-0000-0000-0000-000000000000','authenticated','authenticated','phase1a-def@example.invalid',now(),'{}'::jsonb);";
11
+const setup="BEGIN; INSERT INTO auth.users(id,instance_id,aud,role,email,email_confirmed_at,raw_user_meta_data) VALUES('"+UID+"','00000000-0000-0000-0000-000000000000','authenticated','authenticated','phase1a-def@example.invalid',now(),'{}'::jsonb); INSERT INTO private.finora_phase1a_guard_modes(organization_id,mode) SELECT organization_id,'enforce' FROM public.organization_members WHERE user_id='"+UID+"';";
12
const voucher=(id,status)=>rec('journalVouchers',id,{...meta,status});
13
const line=(id,voucherId,debit,credit)=>rec('journalLines',id,{voucherId,companyId:'TEST',accountId:id,debit,credit});
14
const post=id=>"UPDATE public.records SET data=jsonb_set(data,'{status}','\"posted\"'::jsonb) WHERE organization_id="+org+" AND collection='journalVouchers' AND id='"+id+"';";