Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

1.3 KB
Raw Blame
import test from 'node:test';
import assert from 'node:assert/strict';
import {faultNotice} from '../src/fault-notice.mjs';

test('DB availability updates the notice independently of cloud operation completion',()=>{
 const active={target:'PostgreSQL',status:'restoring',databaseAvailability:'unavailable'};
 assert.match(faultNotice({active},{live:true}),/next stage waits for recovery/);
 const recovered=faultNotice({active:{...active,databaseAvailability:'available'}},{live:true});
 assert.equal(recovered,'PostgreSQL · recovered · cloud operation finishing in background');
 assert.doesNotMatch(recovered,/restoring|waits for recovery/);
 assert.equal(faultNotice({active:null,blocked:false},{live:true}),'');
});
test('failed verification preserves DB availability and non-DB recovery messages',()=>{
 assert.equal(faultNotice({active:{target:'PostgreSQL',status:'recovery_failed',databaseAvailability:'available'},blocked:true}),
  'PostgreSQL · DB available · failover completion not verified');
 assert.equal(faultNotice({active:{target:'Card vault',status:'restoring'}},{live:true}),
  'Card vault · restoring · next stage waits for recovery');
 assert.doesNotMatch(faultNotice({active:{target:'Card vault',status:'restoring'}},{live:true,stopping:true}),/next stage/);
});