-
Notifications
You must be signed in to change notification settings - Fork 26
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(wallet-integration): unit tests for pop up contract #374
base: alex/feat-wallet-integration-refactor
Are you sure you want to change the base?
test(wallet-integration): unit tests for pop up contract #374
Conversation
3f8a910
to
1485dfa
Compare
@@ -620,6 +635,7 @@ mod tests { | |||
} | |||
|
|||
#[tokio::test] | |||
#[ignore] |
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.
Was failing on CI and decided to ignore in order to sort the tests included in this PR.
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## alex/feat-wallet-integration-refactor #374 +/- ##
========================================================================
Coverage ? 74.78%
========================================================================
Files ? 61
Lines ? 13541
Branches ? 13541
========================================================================
Hits ? 10126
Misses ? 2075
Partials ? 1340
|
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.
Nice!!! Looking good. Left a few comments for minor adjustments / thoughts.
gas_limit: None, | ||
proof_size: None, |
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.
would be nice if these were some value to ensure pop-cli isn't just taking the default None.
@@ -46,6 +46,7 @@ mod tests { | |||
// This is a helper test for an actual running pop CLI. | |||
// It can serve as the "frontend" to query the payload, sign it | |||
// and submit back to the CLI. | |||
#[ignore] | |||
#[tokio::test] | |||
async fn sign_call_data() -> anyhow::Result<()> { |
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.
can be removed if its purpose is properly represented elsewhere in the tests.
// This struct implements the [`Payload`] trait and is used to submit | ||
// pre-encoded SCALE call data directly, without the dynamic construction of transactions. | ||
struct CallData(Vec<u8>); | ||
impl Payload for CallData { |
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.
leaving a note: I copied this from the pop call parachain PR (IIRC). Once everything gets merged in we should hopefully be able to just import this.
/// Transaction payload to be sent to frontend for signing. | ||
#[derive(Serialize, Debug)] | ||
#[cfg_attr(test, derive(Deserialize, Clone))] | ||
pub struct TransactionData { |
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.
any reason this wasn't just imported?
/// Test the contract lifecycle: new, build, up, call | ||
#[tokio::test] | ||
async fn contract_lifecycle() -> Result<()> { | ||
const DEFAULT_PORT: u16 = 9944; | ||
const DEFAULT_ENDPOINT: &str = "ws://127.0.0.1:9944"; |
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.
would recommend changing this port away from 9944 -- maybe use free_port as well?
/// Test the contract lifecycle: new, build, up, call | ||
#[tokio::test] | ||
async fn contract_lifecycle() -> Result<()> { | ||
const DEFAULT_PORT: u16 = 9944; | ||
const DEFAULT_ENDPOINT: &str = "ws://127.0.0.1:9944"; | ||
const WALLET_INT_URI: &str = "http://127.0.0.1:9090"; |
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.
Not for this PR, but likely need something to componentize things a little more and let us alter the address for the wallet integration. This port 9090 is going to conflict with some other tests.
This PR covers the addition of unit tests for the wallet integration with
pop up contracts
.fn wait_for_signature
is tested as part of an integration test inpop-cli/tests/contracts.rs
.The integration test the https server handling the signature of payloads has been included in the test
contract_lifecycle
inpop-cli/tests/contracts.rs
.Retrieving the correct upload and instantiation call data is tested in
pop-cli/src/commands/up/contract.rs
inget_upload_call_data_works
andget_instantiate_call_data_works
tests.[sc-1887]