Skip to content

Commit f91292f

Browse files
committed
fixup! cleanProposal test
1 parent 9fb3e2a commit f91292f

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

packages/zoe/test/unitTests/cleanProposal.test.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { cleanProposal } from '../../src/cleanProposal.js';
55
import { setup } from './setupBasicMints.js';
66
import buildManualTimer from '../../tools/manualTimer.js';
77

8+
/**
9+
* @import {HasBound} from '@agoric/ertp';
10+
*/
11+
812
const proposeGood = (t, proposal, assetKind, expected) =>
913
t.deepEqual(
1014
cleanProposal(harden(proposal), () => assetKind),
@@ -96,17 +100,20 @@ test('cleanProposal - wrong assetKind', t => {
96100
test('cleanProposal - want patterns', t => {
97101
const { moola, simoleans } = setup();
98102
const timer = buildManualTimer(t.log);
103+
const wantAsset2HasBound = simoleans(
104+
/** @type {HasBound} */ (M.containerHas(M.any())),
105+
);
99106

100107
proposeGood(
101108
t,
102109
{
103-
want: { Asset2: M.any() },
110+
want: { Asset2: wantAsset2HasBound },
104111
give: { Price2: moola(3n) },
105112
exit: { afterDeadline: { timer, deadline: 100n } },
106113
},
107114
'nat',
108115
{
109-
want: { Asset2: M.any() },
116+
want: { Asset2: wantAsset2HasBound },
110117
give: { Price2: moola(3n) },
111118
exit: { afterDeadline: { timer, deadline: 100n } },
112119
},
@@ -127,22 +134,22 @@ test('cleanProposal - want patterns', t => {
127134
t,
128135
{
129136
want: { Asset2: simoleans(1n) },
130-
give: { Price2: M.any() },
137+
give: { Price2: M.containerHas(M.any()) },
131138
exit: { afterDeadline: { timer, deadline: 100n } },
132139
},
133140
'nat',
134-
'A passable tagged "match:any" is not a key: "[match:any]"',
141+
'A passable tagged "match:containerHas" is not a key: "[match:containerHas]"',
135142
);
136143

137144
proposeBad(
138145
t,
139146
{
140147
want: { Asset2: simoleans(1n) },
141-
give: { Price2: M.any() },
148+
give: { Price2: M.containerHas(M.any()) },
142149
exit: { afterDeadline: { timer, deadline: M.any() } },
143150
},
144151
'nat',
145-
'A passable tagged "match:any" is not a key: "[match:any]"',
152+
'A passable tagged "match:containerHas" is not a key: "[match:containerHas]"',
146153
);
147154
});
148155

packages/zoe/test/unitTests/setupBasicMints.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { makeIssuerKit, AmountMath } from '@agoric/ertp';
1+
import { makeIssuerKit } from '@agoric/ertp';
22
import { makeScalarMapStore } from '@agoric/store';
33
import { makeZoeForTest } from '../../tools/setup-zoe.js';
44
import { makeFakeVatAdmin } from '../../tools/fakeVatAdmin.js';
55

66
/**
77
* @import {MapStore} from '@agoric/swingset-liveslots';
8+
* @import {AmountBound, AmountValueBound} from '@agoric/ertp';
89
*/
910

1011
export const setup = () => {
@@ -26,8 +27,13 @@ export const setup = () => {
2627
const { admin: fakeVatAdmin, vatAdminState } = makeFakeVatAdmin();
2728
const zoe = makeZoeForTest(fakeVatAdmin);
2829

29-
/** @type {(brand: Brand<'nat'>) => (value: bigint) => Amount<'nat'>} */
30-
const makeSimpleMake = brand => value => AmountMath.make(brand, value);
30+
// The following more correct type causes an explosion of new lint errors
31+
// /**
32+
// * @template {AssetKind} [AK='nat']
33+
// * @param {Brand<AK>} brand
34+
// * @returns {(value: AmountValueBound<AK>) => AmountBound<AK>}
35+
// */
36+
const makeSimpleMake = brand => value => harden({ brand, value });
3137

3238
const result = {
3339
moolaIssuer: moolaKit.issuer,

0 commit comments

Comments
 (0)