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

+9 -2
View File
@@ -53,7 +53,9 @@ void test('the offer packet retains legacy two-party terms and validates an expl
assert.equal(publicDealOfferAction(['b','c'], 'Terms', payment, 'a', 2, {...travel, actor:'c'}), null);
assert.deepEqual(publicDealOfferAction(['b'], 'Terms', payment, 'a', 2, travel),
{type:'dealOffer', target:'b', terms:'Terms', payment, travel});
assert.equal(publicDealOfferAction(['b'], 'Terms', {...payment,payer:'b',recipient:'a'}, 'a', 2, travel), null);
const reverse = {...payment,payer:'b',recipient:'a'};
assert.deepEqual(publicDealOfferAction(['b'], 'Terms', reverse, 'a', 2, travel),
{type:'dealOffer', target:'b', terms:'Terms', payment:reverse, travel});
assert.equal(publicDealOfferAction(['b'], 'Terms', {kind:'deferredBribe',payer:'a',recipient:'b',amount:2,dueTurn:2}, 'a', 2, travel), null);
assert.equal(publicDealOfferAction(['b','c'], 'Terms', payment, 'a', 2, travel), null);
assert.equal(publicDealOfferAction(['a'], 'Terms', undefined, 'a', 2, travel), null);
@@ -142,7 +144,12 @@ void test('the authoring controls compose a proposer payment with recipient trav
travel:{kind:'ship',territory:'carthag',minimum:1,answer:true}});
ui.select(0,'deferredBribe'); assert.equal(button()?.props.disabled,true);
ui.select(0,'immediateBribe'); ui.select(1,'b'); ui.select(2,'a');
assert.equal(button()?.props.disabled,true);
assert.equal(button()?.props.disabled,false);
const reverseForm = ui.render().find(node => node.type === 'form'); assert.ok(reverseForm);
(reverseForm.props.onSubmit as (event:{preventDefault():void}) => void)({preventDefault() {}});
assert.deepEqual(JSON.parse(JSON.stringify(ui.sent[1])), {type:'dealOffer',target:'b',terms:'Travel for spice',
payment:{kind:'immediateBribe',payer:'b',recipient:'a',amount:1},
travel:{kind:'ship',territory:'carthag',minimum:1,answer:true}});
});
void test('a payment can also be added after selecting the travel term', () => {