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

Integration tests #83

Merged
merged 18 commits into from
Nov 15, 2023
5 changes: 0 additions & 5 deletions agoric/.yarnrc

This file was deleted.

2 changes: 2 additions & 0 deletions agoric/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"devDependencies": {
"@agoric/eslint-config": "agoric-upgrade-11",
"@endo/eslint-plugin": "^0.4.4",
"@agoric/swingset-vat": "^0.32.2",
"@endo/promise-kit": "^0.2.59",
"@jessie.js/eslint-plugin": "^0.4.0",
"ava": "^4.3.1",
"eslint": "^8.47.0",
Expand Down
4 changes: 2 additions & 2 deletions agoric/contract/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ harden(meta);
*
* @param {Baggage} baggage
*/
export const start = async (zcf, privateArgs, baggage) => {
export const prepare = async (zcf, privateArgs, baggage) => {
const terms = zcf.getTerms();

// TODO: move to proposal
Expand Down Expand Up @@ -178,4 +178,4 @@ export const start = async (zcf, privateArgs, baggage) => {
});
};

harden(start);
harden(prepare);
1 change: 0 additions & 1 deletion agoric/contract/src/proposal/start-kread-proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ export const startKread = async (powers, config) => {
issuers: { KREAdCHARACTER: characterIssuer, KREAdITEM: itemIssuer },
brands: { KREAdCHARACTER: characterBrand, KREAdITEM: itemBrand },
} = await E(zoe).getTerms(instance);

trace('adding to boardAux');
await publishBrandInfo(chainStorage, board, characterBrand);
await publishBrandInfo(chainStorage, board, itemBrand);
Expand Down
2 changes: 1 addition & 1 deletion agoric/contract/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const provideRecorderKits = async (
paths,
typeMatchers,
) => {
console.log('provideRecorderKits', paths, typeMatchers);
// console.log('provideRecorderKits', paths, typeMatchers);
const keys = Object.keys(paths);
// assume if any keys are defined they all are
const inBaggage = baggage.has(keys[0]);
Expand Down
2 changes: 1 addition & 1 deletion agoric/contract/test/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const bootstrapContext = async (conf = undefined) => {
character: { issuer: characterIssuer, brand: characterBrand },
item: { issuer: itemIssuer, brand: itemBrand },
};

const purses = {
character: characterIssuer.makeEmptyPurse(),
item: itemIssuer.makeEmptyPurse(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { AmountMath } from '@agoric/ertp';
import { makeCopyBag } from '@agoric/store';
import { E } from '@endo/far';
import { flow } from '../flow.js';

export async function blockMethods(context) {
/** @type {Context} */
const { publicFacet, governorFacets, contractAssets, purses, zoe } = context;

await E(governorFacets.creatorFacet).setFilters(['mintCharacterNfts']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering how to revert this, maybe await E(governorFacets.creatorFacet).setFilters([]);?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I havent really looked into this but what you wrote makes sense. It should really affect the tests though cause each test file runs independent of the others.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that makes sense, I'll check with Agoric about this


console.log(`TG `, (await E(purses.item).getCurrentAmount()).value.payload);

const { want } = flow.mintCharacter.expected;

const mintCharacterInvitation = await E(
publicFacet,
).makeMintCharacterInvitation();
const copyBagAmount = makeCopyBag(harden([[want, 1n]]));
const proposal = harden({
want: {
Asset: AmountMath.make(
contractAssets.character.brand,
harden(copyBagAmount),
),
},
});

try {
await E(zoe).offer(mintCharacterInvitation, proposal);
} catch (error) {
assert.equal(
error.message,
'not accepting offer with description "mintCharacterNfts"',
);
throw error;
}
}
Loading
Loading