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

tests: refactor and add new tests #1405

Merged
merged 7 commits into from
Jan 10, 2024

Conversation

lambda-0x
Copy link
Collaborator

follow up: #1358

@lambda-0x
Copy link
Collaborator Author

@kariy signer method returns a LocalWallet which doesn't provide access to its inner types.

so to verify if two LocalWallets are same (in the test) we would need to use async methods which would require making tests more complicated.

any other ideas to test the signer method?

@glihm
Copy link
Collaborator

glihm commented Jan 8, 2024

so to verify if two LocalWallets are same (in the test) we would need to use async methods which would require making tests more complicated.

Without adding more complexity, you may try to use a tokio::test instead where you can use async functions. Or is there an other restriction I'm not seeing here?

@lambda-0x
Copy link
Collaborator Author

so to verify if two LocalWallets are same (in the test) we would need to use async methods which would require making tests more complicated.

Without adding more complexity, you may try to use a tokio::test instead where you can use async functions. Or is there an other restriction I'm not seeing here?

Yeah I think that should probably work but I was wondering if there is any better way to do it

@kariy
Copy link
Member

kariy commented Jan 9, 2024

any other ideas to test the signer method?

Yeah, as @glihm mentioned, tokio::test is fine.

@lambda-0x lambda-0x marked this pull request as ready for review January 9, 2024 19:10
Copy link
Collaborator

@glihm glihm left a comment

Choose a reason for hiding this comment

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

Good work on that!

May worth ordering the test by tested field for easier navigation and verification of which test is here.

crates/sozo/src/commands/options/account.rs Outdated Show resolved Hide resolved
crates/sozo/src/commands/options/account.rs Show resolved Hide resolved
crates/sozo/src/commands/options/account.rs Outdated Show resolved Hide resolved
…e specifying `private_key` to be consistent with `keystore`
@@ -33,7 +33,6 @@ pub struct AccountOptions {

#[arg(long = "password", env = DOJO_KEYSTORE_PASSWORD_ENV_VAR)]
#[arg(value_name = "PASSWORD")]
#[arg(requires = "keystore_path")]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed this require so that when passing keystore_password we can still get keystore_path from environment metadata

crates/sozo/src/commands/options/account.rs Outdated Show resolved Hide resolved
pub struct AccountOptions {
#[arg(long, env = DOJO_ACCOUNT_ADDRESS_ENV_VAR)]
pub account_address: Option<FieldElement>,

#[arg(long, env = DOJO_PRIVATE_KEY_ENV_VAR)]
#[arg(requires = "account_address")]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed to be consistent with the behaviour of keystore.

user can specify account_address in Scarb.toml and provide private_key from commandline.

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (36e5853) 67.13% compared to head (84b20dc) 67.51%.
Report is 2 commits behind head on main.

❗ Current head 84b20dc differs from pull request most recent head 9bf0a08. Consider uploading reports for the commit 9bf0a08 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1405      +/-   ##
==========================================
+ Coverage   67.13%   67.51%   +0.37%     
==========================================
  Files         231      231              
  Lines       20858    21023     +165     
==========================================
+ Hits        14003    14193     +190     
+ Misses       6855     6830      -25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tarrencev tarrencev merged commit 18182a0 into dojoengine:main Jan 10, 2024
10 checks passed
@lambda-0x lambda-0x deleted the sozo-options-test branch January 11, 2024 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants