Skip to content

Commit

Permalink
test: repair test for smartWallet changes: throw propogates
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Dec 1, 2023
1 parent 14e677c commit 1d6098a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
40 changes: 25 additions & 15 deletions packages/boot/test/bootstrapTests/test-vaults-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,18 @@ test('close vault', async t => {
const message =
'Offer {"brand":"[Alleged: IST brand]","value":"[1n]"} is not sufficient to pay off debt {"brand":"[Alleged: IST brand]","value":"[5025000n]"}';

// does not throw, because it's in the result, but it will show up in errors
await wd.executeOfferMaker(
Offers.vaults.CloseVault,
{
offerId: 'close-insufficient',
collateralBrandKey,
giveMinted: 0.000_001,
},
'open-vault',
await t.throwsAsync(
() =>
wd.executeOfferMaker(
Offers.vaults.CloseVault,
{
offerId: 'close-insufficient',
collateralBrandKey,
giveMinted: 0.000_001,
},
'open-vault',
),
{ message },
);

t.like(wd.getLatestUpdateRecord(), {
Expand Down Expand Up @@ -232,12 +235,19 @@ test('open vault with insufficient funds gives helpful error', async t => {
const message =
'Proposed debt {"brand":"[Alleged: IST brand]","value":"[904500000n]"} exceeds max {"brand":"[Alleged: IST brand]","value":"[63462857n]"} for {"brand":"[Alleged: ATOM brand]","value":"[9000000n]"} collateral';

await wd.executeOfferMaker(Offers.vaults.OpenVault, {
offerId: 'open-vault',
collateralBrandKey,
giveCollateral,
wantMinted,
});
await t.throwsAsync(
() =>
wd.executeOfferMaker(Offers.vaults.OpenVault, {
offerId: 'open-vault',
collateralBrandKey,
giveCollateral,
wantMinted,
}),
{
message:
'Proposed debt {"brand":"[Alleged: IST brand]","value":"[904500000n]"} exceeds max {"brand":"[Alleged: IST brand]","value":"[63462857n]"} for {"brand":"[Alleged: ATOM brand]","value":"[9000000n]"} collateral',
},
);

t.like(wd.getLatestUpdateRecord(), {
updated: 'offerStatus',
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-wallet/src/offerWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PaymentPKeywordRecordShape,
SeatShape,
} from '@agoric/zoe/src/typeGuards.js';
import { AmountShape } from '@agoric/store/test/borrow-guards.js';
import { AmountShape } from '@agoric/ertp/src/typeGuards.js';
import { objectMap, deeplyFulfilledObject } from '@agoric/internal';

import { UNPUBLISHED_RESULT } from './offers.js';
Expand Down
1 change: 0 additions & 1 deletion packages/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
"dependencies": {
"@agoric/assert": "^0.6.0",
"@agoric/time": "^0.3.2",
"@endo/exo": "^0.2.5",
"@endo/marshal": "^0.8.8",
"@endo/pass-style": "^0.1.6",
Expand Down

0 comments on commit 1d6098a

Please sign in to comment.