Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8445 add promiseWatcher to smartWallet #8488

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
turadg marked this conversation as resolved.
Show resolved Hide resolved

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
Loading