mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
23 lines
843 B
TypeScript
23 lines
843 B
TypeScript
import {
|
|
CUSTOMER_VISIBLE_CHARGE_STATUSES,
|
|
canStaffEditCharge,
|
|
} from './booking-clearance-charge.service';
|
|
import { CLEARANCE_CHARGE_STATUSES } from './entities/booking-clearance-charge.entity';
|
|
|
|
describe('clearance charge status guards', () => {
|
|
it('locks the charge once the customer has accepted or paid', () => {
|
|
expect(canStaffEditCharge('ACCEPTED')).toBe(false);
|
|
expect(canStaffEditCharge('PAID')).toBe(false);
|
|
for (const s of ['DOC_UPLOADED', 'BILLED', 'SENT', 'REJECTED'] as const) {
|
|
expect(canStaffEditCharge(s)).toBe(true);
|
|
}
|
|
});
|
|
|
|
it('hides GL drafts from the customer and shows everything sent', () => {
|
|
const visible = CLEARANCE_CHARGE_STATUSES.filter((s) =>
|
|
CUSTOMER_VISIBLE_CHARGE_STATUSES.has(s),
|
|
);
|
|
expect(visible).toEqual(['SENT', 'REJECTED', 'ACCEPTED', 'PAID']);
|
|
});
|
|
});
|