-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add e2e test for backup and restore
- Loading branch information
Showing
8 changed files
with
95 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use anyhow::Result; | ||
use native::api; | ||
use tests_e2e::app::run_app; | ||
use tests_e2e::logger::init_tracing; | ||
use tests_e2e::setup; | ||
use tokio::task::spawn_blocking; | ||
|
||
#[tokio::test] | ||
#[ignore = "need to be run with 'just e2e' command"] | ||
async fn app_can_be_restored_from_a_backup() -> Result<()> { | ||
init_tracing(); | ||
|
||
let test = setup::TestSetup::new_with_open_position().await; | ||
|
||
let seed_phrase = api::get_seed_phrase(); | ||
|
||
let ln_balance = test | ||
.app | ||
.rx | ||
.wallet_info() | ||
.expect("to have wallet info") | ||
.balances | ||
.lightning; | ||
|
||
// kill the app | ||
test.app.stop(); | ||
tracing::info!("Shutting down app!"); | ||
|
||
let app = run_app(Some(seed_phrase.0)).await; | ||
|
||
assert_eq!( | ||
app.rx | ||
.wallet_info() | ||
.expect("to have wallet info") | ||
.balances | ||
.lightning, | ||
ln_balance | ||
); | ||
|
||
let positions = spawn_blocking(|| api::get_positions().expect("Failed to get positions")) | ||
.await | ||
.unwrap(); | ||
assert_eq!(1, positions.len()); | ||
|
||
// Test if full backup is running without errors | ||
spawn_blocking(|| api::full_backup().expect("Failed to run full backup")) | ||
.await | ||
.unwrap(); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters