-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show_zero_balance_filter option added (#201)
- Loading branch information
1 parent
e547cd5
commit 4808636
Showing
11 changed files
with
154 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ pub async fn get_token_accounts( | |
mint_address, | ||
&pagination, | ||
page_options.limit, | ||
options, | ||
) | ||
.await?; | ||
|
||
|
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
Binary file added
BIN
+312 Bytes
...unts/show_zero_balance_filter_being_disabled/BE1CkzRjLTXAWcSVCaqzycwXsZ18Yuk3jMDMnPUoHjjS
Binary file not shown.
Binary file added
BIN
+312 Bytes
...unts/show_zero_balance_filter_being_disabled/CyqarC6hyNYvb3EDueyeYrnGeAUjCDtMvWrbtdAnA53a
Binary file not shown.
Binary file added
BIN
+312 Bytes
...ounts/show_zero_balance_filter_being_enabled/BE1CkzRjLTXAWcSVCaqzycwXsZ18Yuk3jMDMnPUoHjjS
Binary file not shown.
Binary file added
BIN
+312 Bytes
...ounts/show_zero_balance_filter_being_enabled/CyqarC6hyNYvb3EDueyeYrnGeAUjCDtMvWrbtdAnA53a
Binary file not shown.
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
24 changes: 24 additions & 0 deletions
24
...ration_tests__test_show_zero_balance_filter__show_zero_balance_filter_being_disabled.snap
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,24 @@ | ||
--- | ||
source: integration_tests/tests/integration_tests/test_show_zero_balance_filter.rs | ||
expression: response | ||
snapshot_kind: text | ||
--- | ||
{ | ||
"total": 1, | ||
"limit": 1000, | ||
"token_accounts": [ | ||
{ | ||
"address": "CyqarC6hyNYvb3EDueyeYrnGeAUjCDtMvWrbtdAnA53a", | ||
"mint": "7Y5WQ2e3FummR2DebrqP8caC64QvXzpnhSTNWjNabxWn", | ||
"amount": 1, | ||
"owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", | ||
"frozen": true, | ||
"delegate": "D98f1ebFe6kfZTcztLo1iPeKAwogbWHAgXzgSpdRDiu7", | ||
"delegated_amount": 1, | ||
"close_authority": null, | ||
"extensions": null | ||
} | ||
], | ||
"cursor": null, | ||
"errors": [] | ||
} |
35 changes: 35 additions & 0 deletions
35
...gration_tests__test_show_zero_balance_filter__show_zero_balance_filter_being_enabled.snap
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,35 @@ | ||
--- | ||
source: integration_tests/tests/integration_tests/test_show_zero_balance_filter.rs | ||
expression: response | ||
snapshot_kind: text | ||
--- | ||
{ | ||
"total": 2, | ||
"limit": 1000, | ||
"token_accounts": [ | ||
{ | ||
"address": "BE1CkzRjLTXAWcSVCaqzycwXsZ18Yuk3jMDMnPUoHjjS", | ||
"mint": "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN", | ||
"amount": 0, | ||
"owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", | ||
"frozen": false, | ||
"delegate": null, | ||
"delegated_amount": 0, | ||
"close_authority": null, | ||
"extensions": null | ||
}, | ||
{ | ||
"address": "CyqarC6hyNYvb3EDueyeYrnGeAUjCDtMvWrbtdAnA53a", | ||
"mint": "7Y5WQ2e3FummR2DebrqP8caC64QvXzpnhSTNWjNabxWn", | ||
"amount": 1, | ||
"owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", | ||
"frozen": true, | ||
"delegate": "D98f1ebFe6kfZTcztLo1iPeKAwogbWHAgXzgSpdRDiu7", | ||
"delegated_amount": 1, | ||
"close_authority": null, | ||
"extensions": null | ||
} | ||
], | ||
"cursor": null, | ||
"errors": [] | ||
} |
83 changes: 83 additions & 0 deletions
83
integration_tests/tests/integration_tests/test_show_zero_balance_filter.rs
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,83 @@ | ||
use function_name::named; | ||
|
||
use das_api::api::{self, ApiContract}; | ||
|
||
use itertools::Itertools; | ||
|
||
use serial_test::serial; | ||
|
||
use super::common::*; | ||
|
||
#[tokio::test] | ||
#[serial] | ||
#[named] | ||
async fn test_show_zero_balance_filter_being_enabled() { | ||
let name = trim_test_name(function_name!()); | ||
|
||
let setup = TestSetup::new_with_options( | ||
name.clone(), | ||
TestSetupOptions { | ||
network: Some(Network::Mainnet), | ||
}, | ||
) | ||
.await; | ||
|
||
let seeds: Vec<SeedEvent> = seed_accounts([ | ||
"BE1CkzRjLTXAWcSVCaqzycwXsZ18Yuk3jMDMnPUoHjjS", | ||
"CyqarC6hyNYvb3EDueyeYrnGeAUjCDtMvWrbtdAnA53a", | ||
]); | ||
|
||
apply_migrations_and_delete_data(setup.db.clone()).await; | ||
index_seed_events(&setup, seeds.iter().collect_vec()).await; | ||
|
||
let request = r#" | ||
{ | ||
"ownerAddress":"2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", | ||
"displayOptions": { | ||
"showZeroBalance": true | ||
} | ||
} | ||
"#; | ||
|
||
let request: api::GetTokenAccounts = serde_json::from_str(request).unwrap(); | ||
let response = setup.das_api.get_token_accounts(request).await.unwrap(); | ||
|
||
insta::assert_json_snapshot!(name, response); | ||
} | ||
|
||
#[tokio::test] | ||
#[serial] | ||
#[named] | ||
async fn test_show_zero_balance_filter_being_disabled() { | ||
let name = trim_test_name(function_name!()); | ||
|
||
let setup = TestSetup::new_with_options( | ||
name.clone(), | ||
TestSetupOptions { | ||
network: Some(Network::Mainnet), | ||
}, | ||
) | ||
.await; | ||
|
||
let seeds: Vec<SeedEvent> = seed_accounts([ | ||
"BE1CkzRjLTXAWcSVCaqzycwXsZ18Yuk3jMDMnPUoHjjS", | ||
"CyqarC6hyNYvb3EDueyeYrnGeAUjCDtMvWrbtdAnA53a", | ||
]); | ||
|
||
apply_migrations_and_delete_data(setup.db.clone()).await; | ||
index_seed_events(&setup, seeds.iter().collect_vec()).await; | ||
|
||
let request = r#" | ||
{ | ||
"ownerAddress":"2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", | ||
"displayOptions": { | ||
"showZeroBalance": false | ||
} | ||
} | ||
"#; | ||
|
||
let request: api::GetTokenAccounts = serde_json::from_str(request).unwrap(); | ||
let response = setup.das_api.get_token_accounts(request).await.unwrap(); | ||
|
||
insta::assert_json_snapshot!(name, response); | ||
} |