-
Notifications
You must be signed in to change notification settings - Fork 214
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
test(a3p): extend test coverage for KREAd app on z:acceptance test phase #10242
Conversation
Deploying agoric-sdk with Cloudflare Pages
|
55f9a44
to
a05465b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. I'd like to see an additional helper, and more use of Amounts.
const path = `:published.kread.market-characters.${charactersMarket[0]}`; | ||
const rawCharacterData = await agoric.follow('-lF', path, '-o', 'text'); | ||
const marketCharacter = marshaller.fromCapData(JSON.parse(rawCharacterData)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please write a helper that will unmarshall from vstorage to Amounts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the effort to keep the new helper function getAssetAmount
agnostic to the asset provided as an argument, I left the query to Vstorage unchanged and used marketCharacter as the argument.
Does this approach work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with passing marketCharacter
to totalAssetPriceAmount
, but I'd still prefer that there be a function for the 4 lines above. (perhaps getMarketCharacterFromVstorage()
).
is 0
a parameter saying which child, or is it always ':published.kread.market-characters.${charactersMarket[0]}'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I addressed the requested change by implementing the new getMarketCharacterFromVstorage helper function.
In this case, there is no need to provide the market-characters children node dynamically because, for the test case built, we only need to ensure that a character is available on the market.
For that reason, I am using the static child index 0.
ae08130
to
91edc18
Compare
const assetValue = makeCopyBag([[asset, 1n]]); | ||
const assetAmount = AmountMath.make( | ||
brand, | ||
//@ts-expect-error casting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary. AmountMath.make
takes CopyBagAmounts by default, so you should be able to declare a type for assetValue
and not have to expect an error. The following worked for me
/** @import {Brand, CopyBagAmount} from '@agoric/ertp'; */
/**
* @param {Brand} brand
* @param {any} asset
* @returns {CopyBagAmount<'item'>}
*/
export const getAssetAmount = (brand, asset) => {
const assetValue = makeCopyBag([[asset, 1n]]);
return AmountMath.make(brand, assetValue);
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested change addressed
ea0db37
to
9082311
Compare
@Chris-Hibbert I am sorry for having requested your re-review yesterday before noticing the linting issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is on the right track. Just a few requests, not all required.
const path = `:published.kread.market-characters.${charactersMarket[0]}`; | ||
const rawCharacterData = await agoric.follow('-lF', path, '-o', 'text'); | ||
const marketCharacter = marshaller.fromCapData(JSON.parse(rawCharacterData)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with passing marketCharacter
to totalAssetPriceAmount
, but I'd still prefer that there be a function for the 4 lines above. (perhaps getMarketCharacterFromVstorage()
).
is 0
a parameter saying which child, or is it always ':published.kread.market-characters.${charactersMarket[0]}'
?
kreadCharacter2, | ||
); | ||
|
||
const id = `KREAd-unequip-all-items-acceptance-test`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a suggestion: I give a separate name to values like this if I'm going to use them more than once, or if pulling them out will make the formatting take fewer lines. Why do you prefer this over
id: `KREAd-unequip-all-items-acceptance-test`,
inside offer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion—I've made the change.
I don't have a strong preference; it was simply a habit of mine.
I now understand your reasoning for when to declare the offer ID outside of the offer body.
I’ll adopt that approach moving forward.
Change requested addressed by implementing the getMarketCharacterFromVstorage helper function. In this case, there is no need to provide the market-characters children node dynamically because, for the test case built, we only need to ensure that a character is available on the market. For that reason, I am using the static the child index 0. |
@Chris-Hibbert while addressing the conflicts in order to rebase this branch into master, I mistakenly included commits that were not done at this branch. Meaning that most of the comments you just raised regards code the I did not do it. |
Base branch is changed to master. Please re-run the integration tests by adding 'force:integration' label. |
Base branch is changed to master. Please re-run the integration tests by adding 'force:integration' label. |
f6481e1
to
5645723
Compare
Greetings @Chris-Hibbert As I mentioned before, while addressing the conflicts after rebasing to master, the commit history displayed unexpected behavior. It showed duplicated commits as well as commits that had already been merged on the master. While trying different approaches to solving the issue, one suggested editing the landing branch to a different one and then back to the original, which is why you can see that change in the conversation and the reason why I added the 'force:integration' label to re-run the integration tests. I was able to solve the problems by doing an interactive rebase, having now a clean commit history, and maintaining the changes that you requested during this review. Thank you for your time and sorry for any inconvenience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
please add one comment before merging.
6431c66
to
f427d35
Compare
closes: https://github.com/Agoric/BytePitchPartnerEng/issues/12
refs: https://github.com/Agoric/BytePitchPartnerEng/issues/9
Description
The existing test of the
KREAd
application on thez:acceptance
test phase was limited to the feature allowing users tomint
a new KREAd Character.This PR extends the existing test coverage to include the following cases:
Along with the
kread.test.js
file, this PR includes a new file,/test-lib/kread.js
, that provides all the requiredhelper functions
for the test cases above, allowing a cleaner and scalable design for KREAd tests.Since the test coverage of the new file overlaps with the existing one, I opted for removing both:
Security Considerations
No security considerations were identified.
Scaling Considerations
No scaling considerations were identified.
Documentation Considerations
No documentation considerations were identified.
Testing Considerations
I have confirmed that this works fine with existing a3p tests locally, there is still an improvement that may be useful to ensure that the user wallet's purse balance for the desired KREAd asset was updated accordingly.
For this purpose, we intend to use one feature included in the currently open PR #10171 , which is the sync-tools method
retryUntilCondition()
.However, we hope to address those changes in a different PR that will be the result of the effort put into the currently open ticket