Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

1 import {describe,expect,it} from 'vitest'; import {authorize} from './authorization';
2 describe('server authorization',()=>{it('denies maker approval',()=>expect(authorize({roles:['MAKER'],actorId:'u1'},'APPROVE',{makerId:'u1'})).toBe(false));it('allows checker approval of another maker',()=>expect(authorize({roles:['CHECKER'],actorId:'u2'},'APPROVE',{makerId:'u1'})).toBe(true));it('requires treasury admin for emergency stop',()=>{expect(authorize({roles:['CHECKER'],actorId:'u2'},'EMERGENCY_STOP',{})).toBe(false);expect(authorize({roles:['TREASURY_ADMIN'],actorId:'u3'},'EMERGENCY_STOP',{})).toBe(true)})});