Support immediate payments in group travel deals
Verify and publish checkpoint container / container (push) Successful in 10m49s
Verify and publish checkpoint container / container (push) Successful in 10m49s
This commit is contained in:
1 parent
3987c5c16b
commit
6c1530382d
10 files changed
+207
-24
No files matched your search
@@ -50,7 +50,11 @@ void test('the offer packet retains legacy two-party terms and validates an expl
|
||||
assert.equal(publicDealOfferAction(['b','c'], 'Terms', undefined, 'a', 2, {...travel, actor:'a'}), null);
|
||||
assert.equal(publicDealOfferAction(['b','c'], 'Terms', undefined, 'a', 2, {...travel, actor:'d'}), null);
|
||||
assert.equal(publicDealOfferAction(['b'], 'Terms', undefined, 'a', 2, {...travel, actor:'b'}), null);
|
||||
assert.equal(publicDealOfferAction(['b','c'], 'Terms', payment, 'a', 2, {...travel, actor:'c'}), null);
|
||||
assert.deepEqual(publicDealOfferAction(['b','c'], 'Terms', payment, 'a', 2, {...travel, actor:'c'}),
|
||||
{type:'dealOffer', targets:['b','c'], terms:'Terms', payment, travel:{...travel, actor:'c'}});
|
||||
assert.deepEqual(publicDealOfferAction(['b','c'], 'Terms', {...payment,payer:'b',recipient:'c'}, 'a', 2, {...travel, actor:'c'}),
|
||||
{type:'dealOffer', targets:['b','c'], terms:'Terms', payment:{...payment,payer:'b',recipient:'c'}, travel:{...travel, actor:'c'}});
|
||||
assert.equal(publicDealOfferAction(['b','c'], 'Terms', {kind:'deferredBribe',payer:'a',recipient:'b',amount:2,dueTurn:2}, 'a', 2, {...travel, actor:'c'}), null);
|
||||
assert.deepEqual(publicDealOfferAction(['b'], 'Terms', payment, 'a', 2, travel),
|
||||
{type:'dealOffer', target:'b', terms:'Terms', payment, travel});
|
||||
const reverse = {...payment,payer:'b',recipient:'a'};
|
||||
@@ -205,6 +209,11 @@ void test('group offers name the traveler, require their last vote and still per
|
||||
assert.ok(accept); assert.equal(accept.props.disabled,false);
|
||||
(accept.props.onClick as () => void)();
|
||||
assert.deepEqual(finalActions.at(-1),{type:'dealRespond',deal:'deal',accept:true});
|
||||
const paid = {...final, bribeOptions:{blocked:'Your own funds are committed'},
|
||||
deals:[{...group,acceptVotes:['a','b','d'],payment:{kind:'immediateBribe',payer:'b',recipient:'d',amount:2}}]} as unknown as GameView;
|
||||
assert.equal(elements(PublicDealList({game:paid,disabled:false,act() {}}))
|
||||
.find(node => node.props.children === 'Accept deal')?.props.disabled,false,
|
||||
'The traveler’s own bribe quote cannot reject another participant’s payment.');
|
||||
const active = {...game, deals:[{...group,status:'active',acceptVotes:['a','b','c','d']}],
|
||||
dealTravelStatus:{deal:'pending'}} as unknown as GameView;
|
||||
assert.deepEqual(publicDealRequests(active), [['travel','deal']]);
|
||||
@@ -230,7 +239,15 @@ void test('the group offer form selects an invited traveler and revalidates part
|
||||
ui.check(2); // Add Dara after removing the chosen traveler.
|
||||
assert.equal(button()?.props.disabled,true);
|
||||
ui.select(0,'d'); assert.equal(button()?.props.disabled,false);
|
||||
ui.check(3); assert.equal(button()?.props.disabled,true, 'Group travel cannot be combined with payment.');
|
||||
ui.check(3); assert.equal(button()?.props.disabled,true, 'The payer and recipient must be selected.');
|
||||
ui.select(1,'b'); ui.select(2,'d');
|
||||
assert.equal(button()?.props.disabled,false);
|
||||
const paidForm = ui.render().find(node => node.type === 'form'); assert.ok(paidForm);
|
||||
(paidForm.props.onSubmit as (event:{preventDefault():void}) => void)({preventDefault() {}});
|
||||
assert.deepEqual(JSON.parse(JSON.stringify(ui.sent[1])), {type:'dealOffer',targets:['b','d'],terms:'Group travel',
|
||||
payment:{kind:'immediateBribe',payer:'b',recipient:'d',amount:1},
|
||||
travel:{kind:'ship',territory:'carthag',minimum:1,answer:true,actor:'d'}});
|
||||
ui.select(0,'deferredBribe'); assert.equal(button()?.props.disabled,true, 'Deferred group payment remains unavailable.');
|
||||
});
|
||||
|
||||
void test('the author chooses a future travel turn and can return to the legacy current-turn packet', () => {
|
||||
|
||||
Reference in new issue
Block a user