Skip to content

Commit

Permalink
fix: add a default offerHandler (#1759)
Browse files Browse the repository at this point in the history
  • Loading branch information
katelynsills authored Sep 15, 2020
1 parent 068f4b1 commit d25052d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 5 additions & 1 deletion packages/zoe/src/contractFacet/contractFacet.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@ export function buildRootObject(_powers, _params, testJigSetter = undefined) {
// AWAIT ///
return registerIssuerRecordWithKeyword(keyword, record);
},
makeInvitation: (offerHandler, description, customProperties = {}) => {
makeInvitation: (
offerHandler = () => {},
description,
customProperties = {},
) => {
assert.typeof(
description,
'string',
Expand Down
2 changes: 1 addition & 1 deletion packages/zoe/src/contractFacet/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
* getting in the `customProperties`. `customProperties` will be
* placed in the extent of the invitation.
*
* @param {OfferHandler} offerHandler - a contract specific function
* @param {OfferHandler=} offerHandler - a contract specific function
* that handles the offer, such as saving it or performing a trade
* @param {string} description
* @param {Object=} customProperties
Expand Down
8 changes: 2 additions & 6 deletions packages/zoe/test/unitTests/zcf/test-zcf.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,8 @@ test(`zcf.makeInvitation - no offerHandler`, async t => {
const isLive = await E(invitationIssuer).isLive(invitationP);
t.truthy(isLive);
const seat = E(zoe).offer(invitationP);

// TODO: this should not throw
// https://github.com/Agoric/agoric-sdk/issues/1703
// const offerResult = await E(seat).getOfferResult();
// t.is(offerResult, undefined);
await t.throwsAsync(() => E(seat).getOfferResult());
const offerResult = await E(seat).getOfferResult();
t.is(offerResult, undefined);
});

test(`zcf.makeInvitation - no-op offerHandler`, async t => {
Expand Down

0 comments on commit d25052d

Please sign in to comment.