From 1d6098a0ad011184db6905fdfaa1f00f079503ca Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Thu, 30 Nov 2023 16:40:55 -0800 Subject: [PATCH] test: repair test for smartWallet changes: throw propogates --- .../bootstrapTests/test-vaults-integration.ts | 40 ++++++++++++------- packages/smart-wallet/src/offerWatcher.js | 2 +- packages/store/package.json | 1 - 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/packages/boot/test/bootstrapTests/test-vaults-integration.ts b/packages/boot/test/bootstrapTests/test-vaults-integration.ts index 3ef9be4ff4f3..8d17b1e0f233 100644 --- a/packages/boot/test/bootstrapTests/test-vaults-integration.ts +++ b/packages/boot/test/bootstrapTests/test-vaults-integration.ts @@ -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(), { @@ -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', diff --git a/packages/smart-wallet/src/offerWatcher.js b/packages/smart-wallet/src/offerWatcher.js index 66e4a5094445..6abfff13900c 100644 --- a/packages/smart-wallet/src/offerWatcher.js +++ b/packages/smart-wallet/src/offerWatcher.js @@ -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'; diff --git a/packages/store/package.json b/packages/store/package.json index 6d7148c6dd79..70bb4e127b7d 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -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",