Skip to content

Commit

Permalink
Merge pull request #8488 from Agoric/8445-addWatcher
Browse files Browse the repository at this point in the history
8445 add promiseWatcher to smartWallet
  • Loading branch information
mergify[bot] authored Jan 5, 2024
2 parents 6388a00 + 5ed5107 commit 376e47d
Show file tree
Hide file tree
Showing 16 changed files with 895 additions and 643 deletions.
16 changes: 12 additions & 4 deletions packages/boot/test/bootstrapTests/test-vaults-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '@agoric/vats/tools/board-utils.js';
import type { TestFn } from 'ava';
import { ParamChangesOfferArgs } from '@agoric/inter-protocol/src/econCommitteeCharter.js';

import { makeSwingsetTestKit } from '../../tools/supports.ts';
import { makeWalletFactoryDriver } from '../../tools/drivers.ts';

Expand Down Expand Up @@ -136,6 +137,8 @@ test('adjust balances', async t => {
});
});

// This test isn't marked .serial, but it depends on previous tests.

test('close vault', async t => {
const { walletFactoryDriver } = t.context;

Expand All @@ -151,7 +154,8 @@ test('close vault', async t => {
});
t.like(wd.getLatestUpdateRecord(), {
updated: 'offerStatus',
status: { id: 'open-vault', numWantsSatisfied: 1 },
status: { id: 'open-vault', result: 'UNPUBLISHED', numWantsSatisfied: 1 },
error: undefined,
});
t.log('try giving more than is available in the purse/vbank');
await t.throwsAsync(
Expand All @@ -171,6 +175,7 @@ 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]"}';

await t.throwsAsync(
wd.executeOfferMaker(
Offers.vaults.CloseVault,
Expand All @@ -181,10 +186,9 @@ test('close vault', async t => {
},
'open-vault',
),
{
message,
},
{ message },
);

t.like(wd.getLatestUpdateRecord(), {
updated: 'offerStatus',
status: {
Expand All @@ -204,10 +208,13 @@ test('close vault', async t => {
},
'open-vault',
);

t.like(wd.getLatestUpdateRecord(), {
updated: 'offerStatus',
status: {
id: 'close-well',
error: undefined,
numWantsSatisfied: 1,
result: 'your vault is closed, thank you for your business',
// funds are returned
payouts: likePayouts(giveCollateral, 0),
Expand All @@ -226,6 +233,7 @@ test('open vault with insufficient funds gives helpful error', async t => {
const wantMinted = giveCollateral * 100;
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 t.throwsAsync(
wd.executeOfferMaker(Offers.vaults.OpenVault, {
offerId: 'open-vault',
Expand Down
Loading

0 comments on commit 376e47d

Please sign in to comment.