|
9 | 9 | makeWalletFactoryContext, |
10 | 10 | type WalletFactoryTestContext as TC, |
11 | 11 | } from './walletFactory.ts'; |
| 12 | +import type { NameHub } from '@agoric/vats'; |
12 | 13 |
|
13 | 14 | const nodeRequire = createRequire(import.meta.url); |
14 | 15 |
|
@@ -42,6 +43,9 @@ const startContract = async (t: ExecutionContext<TC>) => { |
42 | 43 | return started; |
43 | 44 | }; |
44 | 45 |
|
| 46 | +const arrowBody = (f: Function) => |
| 47 | + `${f}`.match(/\(\) =>\s*(?<body>.*)/)?.groups?.body || assert.fail(); |
| 48 | + |
45 | 49 | test('use offer result without zoe', async t => { |
46 | 50 | const { walletFactoryDriver, agoricNamesRemotes } = t.context; |
47 | 51 | const { EV } = t.context.runUtils; |
@@ -77,7 +81,15 @@ test('use offer result without zoe', async t => { |
77 | 81 | }); |
78 | 82 | t.log('redeemInvitation last update', wd.getLatestUpdateRecord()); |
79 | 83 |
|
80 | | - const initialPrices = await EV(started.publicFacet).getPrices(); |
81 | | - t.log({ initialPrices }); |
82 | | - t.deepEqual(initialPrices, [0n]); |
| 84 | + t.log('initial prices', await EV(started.publicFacet).getPrices()); |
| 85 | + |
| 86 | + const setPriceFn = |
| 87 | + (nameHub = null as unknown as NameHub, E = <T>(x: Awaited<T>) => x) => |
| 88 | + () => |
| 89 | + E(nameHub.lookup('priceSetter')).setPrice(100n); |
| 90 | + |
| 91 | + await wd.evalExpr(arrowBody(setPriceFn)); |
| 92 | + const actual = await EV(started.publicFacet).getPrices(); |
| 93 | + t.log('prices after', actual); |
| 94 | + t.deepEqual(actual, [100n]); |
83 | 95 | }); |
0 commit comments