Allow travelers to pay in two-party travel deals
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-10-29 17:39:06 +11:00
1 parent c1ffa1c28a
commit 3987c5c16b
9 files changed
+90 -21

No files matched your search

+4 -5
View File
@@ -172,8 +172,8 @@ void test('multiparty travel rejects forged actors, early votes, payments and no
assert.equal(respondPublicDeal(acceptedOther, seats, 'b', true).status, 'active');
});
void test('a proposer-to-recipient immediate payment can accompany travel through the complete deal lifecycle', () => {
const payment = { kind: 'immediateBribe', payer: 'a', recipient: 'b', amount: 3 } as const;
for (const [payer, recipient] of [['a', 'b'], ['b', 'a']] as const) void test(`a ${payer}-to-${recipient} immediate payment can accompany travel through the complete deal lifecycle`, () => {
const payment = { kind: 'immediateBribe', payer, recipient, amount: 3 } as const;
const original = createPublicDeal(seats, 'a', 'b', 'Payment for travel.', 3, 'paid-travel', payment);
const offered = setPublicDealTravel(original, term, seats);
assert.equal(original.travel, undefined);
@@ -193,11 +193,10 @@ void test('a proposer-to-recipient immediate payment can accompany travel throug
assert.equal(released.status, 'released');
});
void test('paid travel rejects reverse, deferred, multiparty and forged persisted payment shapes', () => {
const reverse = { kind: 'immediateBribe', payer: 'b', recipient: 'a', amount: 1 } as const;
void test('paid travel rejects deferred, multiparty and forged persisted payment shapes', () => {
const deferred = { kind: 'deferredBribe', payer: 'a', recipient: 'b', amount: 1, dueTurn: 3 } as const;
const paid = { kind: 'immediateBribe', payer: 'a', recipient: 'b', amount: 1 } as const;
for (const payment of [reverse, deferred]) {
for (const payment of [deferred]) {
const offer = createPublicDeal(seats, 'a', 'b', 'Terms', 3, `invalid-${payment.kind}`, payment);
assert.throws(() => setPublicDealTravel(offer, term, seats), PublicDealError);
assert.throws(() => validatePublicDeals([{ ...offer, travel: term }], seats), PublicDealError);