Skip to content

Commit

Permalink
test: clarify startContract()
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jun 4, 2024
1 parent 043dc25 commit 454f184
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
14 changes: 8 additions & 6 deletions packages/orchestration/test/examples/stake-atom.contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ const contractFile = `${dirname}/../../src/examples/stakeAtom.contract.js`;
type StartFn =
typeof import('@agoric/orchestration/src/examples/stakeAtom.contract.js').start;

const coreEval = async (
t,
{ orchestration, timer, marshaller, storage, bld },
) => {
t.log('install stakeAtom contract');
const startContract = async ({
orchestration,
timer,
marshaller,
storage,
bld,
}) => {
const { zoe, bundleAndInstall } = await setUpZoeForTest();
const installation: Installation<StartFn> =
await bundleAndInstall(contractFile);
Expand Down Expand Up @@ -46,7 +48,7 @@ test('makeAccount, deposit, withdraw', async t => {
brands: { ist },
utils,
} = await commonSetup(t);
const { publicFacet } = await coreEval(t, { ...bootstrap, bld: ist });
const { publicFacet } = await startContract({ ...bootstrap, bld: ist });

t.log('make an ICA account');
const account = await E(publicFacet).makeAccount();
Expand Down
15 changes: 10 additions & 5 deletions packages/orchestration/test/examples/stake-bld.contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ const contractFile = `${dirname}/../../src/examples/stakeBld.contract.js`;
type StartFn =
typeof import('@agoric/orchestration/src/examples/stakeBld.contract.js').start;

const coreEval = async (t, { timer, localchain, marshaller, storage, bld }) => {
t.log('install stakeBld contract');
const startContract = async ({
timer,
localchain,
marshaller,
storage,
bld,
}) => {
const { zoe, bundleAndInstall } = await setUpZoeForTest();
const installation: Installation<StartFn> =
await bundleAndInstall(contractFile);
Expand All @@ -39,7 +44,7 @@ test('makeAccount, deposit, withdraw', async t => {
brands: { bld },
utils,
} = await commonSetup(t);
const { publicFacet } = await coreEval(t, { ...bootstrap, bld });
const { publicFacet } = await startContract({ ...bootstrap, bld });

t.log('make a LocalChainAccount');
const account = await E(publicFacet).makeAccount();
Expand Down Expand Up @@ -72,7 +77,7 @@ test('makeStakeBldInvitation', async t => {
brands: { bld },
utils,
} = await commonSetup(t);
const { publicFacet, zoe } = await coreEval(t, { ...bootstrap, bld });
const { publicFacet, zoe } = await startContract({ ...bootstrap, bld });

t.log('call makeStakeBldInvitation');
const inv = await E(publicFacet).makeStakeBldInvitation();
Expand Down Expand Up @@ -113,7 +118,7 @@ test('makeAccountInvitationMaker', async t => {
bootstrap,
brands: { bld },
} = await commonSetup(t);
const { publicFacet, zoe } = await coreEval(t, { ...bootstrap, bld });
const { publicFacet, zoe } = await startContract({ ...bootstrap, bld });

const inv = await E(publicFacet).makeAccountInvitationMaker();

Expand Down

0 comments on commit 454f184

Please sign in to comment.