Environment variables
This commit is contained in:
@@ -211,6 +211,21 @@ test('configuration requires secret files, verified TLS, literal backend, and lo
|
||||
await assert.rejects(postgresConfig({ WIKIDECK_CUSTODY_PG_URL_FILE: file }), /configuration/);
|
||||
});
|
||||
|
||||
test('PostgreSQL market disable preserves existing claims and signed withdrawal cancellation', async t => {
|
||||
const f = await fixture(t); await f.execute(buyer, { type: 'mock-credit' });
|
||||
const listing = await f.execute(seller, { type: 'list', cardHash: hash, sequence: 0, priceAtomicXmr: '100', feeBps: 250 }) as CustodyListing;
|
||||
const order = await f.execute(buyer, { type: 'reserve', listingId: listing.id, priceAtomicXmr: '100', feeBps: 250 }) as CustodyOrder;
|
||||
const disabled = await PostgresCustody.open(f.runtime, { ...options, marketEnabled: false });
|
||||
try {
|
||||
assert.equal(disabled.info().marketEnabled, false); assert.deepEqual((await disabled.browse()).listings, []);
|
||||
await assert.rejects(disabled.execute(envelope(disabled.id, other, { type: 'mock-credit' })), /disabled/);
|
||||
await disabled.execute(envelope(disabled.id, buyer, { type: 'cancel-reservation', orderId: order.id }));
|
||||
const w = await disabled.execute(envelope(disabled.id, buyer, { type: 'withdraw', destination: 'mock-external', amountAtomicXmr: '1', maxFeeAtomicXmr: '0' })) as CustodyWithdrawal;
|
||||
await disabled.execute(envelope(disabled.id, buyer, { type: 'cancel-withdrawal', withdrawalId: w.id }));
|
||||
assert.equal((await disabled.audit()).assetsAtomicXmr, '1000000000000');
|
||||
} finally { await disabled.close(); }
|
||||
});
|
||||
|
||||
test('full PostgreSQL dump/isolated restore preserves custody identity, receipts and journal backing', async t => {
|
||||
const f = await fixture(t); await f.execute(buyer, { type: 'mock-credit' });
|
||||
const cmd = envelope(f.market.id, buyer, { type: 'withdraw', destination: 'mock-external', amountAtomicXmr: '500', maxFeeAtomicXmr: '20' });
|
||||
|
||||
Reference in New Issue
Block a user