From 8621eca5d2b22e3f17935b42c3e5c9cfc54e2040 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Fri, 22 Nov 2019 15:27:52 -0600 Subject: [PATCH] fix(zoe): have install accept a moduleFormat argument (#235) This is needed to be compatible with future bundle formats. --- core/zoe/zoe/zoe.js | 17 +++++++++++++++-- test/swingsetTests/zoe/test-zoe.js | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/core/zoe/zoe/zoe.js b/core/zoe/zoe/zoe.js index e9247e8222d..7840415e808 100644 --- a/core/zoe/zoe/zoe.js +++ b/core/zoe/zoe/zoe.js @@ -234,9 +234,22 @@ const makeZoe = async (additionalEndowments = {}) => { /** * Create an installation by safely evaluating the code and * registering it with Zoe. + * + * We have a moduleFormat to allow for different future formats + * without silent failures. */ - install: code => { - const installation = evalContractCode(code, additionalEndowments); + install: (code, moduleFormat = 'getExport') => { + let installation; + switch (moduleFormat) { + case 'getExport': { + installation = evalContractCode(code, additionalEndowments); + break; + } + default: { + insist(false)`\ +Unimplemented installation moduleFormat ${moduleFormat}`; + } + } const installationHandle = adminState.addInstallation(installation); return installationHandle; }, diff --git a/test/swingsetTests/zoe/test-zoe.js b/test/swingsetTests/zoe/test-zoe.js index 8008688b494..c990a3a267c 100644 --- a/test/swingsetTests/zoe/test-zoe.js +++ b/test/swingsetTests/zoe/test-zoe.js @@ -108,7 +108,7 @@ test('zoe - coveredCall - valid inputs - with SES', async t => { } }); -test.only('zoe - coveredCall - valid inputs - no SES', async t => { +test('zoe - coveredCall - valid inputs - no SES', async t => { try { const startingExtents = [[3, 0], [0, 7]]; const dump = await main(false, 'zoe', [