mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 17:27:39 +00:00
updated failing btc tests from speedup
This commit is contained in:
parent
4df68dc53a
commit
2e604ad9d4
2 changed files with 292 additions and 141 deletions
|
@ -1,98 +1,98 @@
|
|||
final Map<String, List<dynamic>> historyBatchArgs0 = {
|
||||
"k_0_0": ["269df6359accfa9b761f22c42bd10dcda6fbc6ad708476d2e1efd4b3aa3f6e2f"],
|
||||
"k_0_1": ["a328ae88ebce63c0010709ae900c199df2b585cdebce53a6291886dfdcc28c63"],
|
||||
"k_0_2": ["16a765b755fcd070f5196f5a31d6370a799c5f2adac922bff8768f1c4e710b25"],
|
||||
"k_0_3": ["f3baba5f725918c2038e7a80539088b2c0c636c6a27afb52b94b908241c7a5f8"],
|
||||
"k_0_4": ["e72d39bd9e7b455503a2acae33647cb5ce33c1dc99ef9ebed0e7501b5e387f86"],
|
||||
"k_0_5": ["7d9beb602c191843af7e0aef8d588f01bb9c5e2252a3eb29d92bb05833f924df"],
|
||||
"k_0_6": ["6ab497d1554279dc0723ba1513ff687991454e6f720a79de2c1403b0de7fef73"],
|
||||
"k_0_7": ["fb33f2529224ddbb65056dd98296f5b9aad5fd31d2ec4db51520e38809d4ec38"],
|
||||
"k_0_8": ["e7cb000615b4ecf2d483279fa437f37acd9deab1e9f3f4e94d4419c33e521753"],
|
||||
"k_0_9": ["d07ba311749923b3d6c2a291a3be9bcaf43e1fb1b97cb1b262c93672eda50823"],
|
||||
"k_0_10": [
|
||||
"cae047098603b4f4dedb5a5f7f3a0e0f6f0233eed8e0c06f47855c11ccf0a664"
|
||||
],
|
||||
"k_0_11": ["6bdefed2a12896dd9840efd83c265e08f9131406c98839d4089377f517cbb977"]
|
||||
};
|
||||
final Map<String, List<dynamic>> historyBatchArgs1 = {
|
||||
"k_0_0": ["8e33ea48a5fabb82e44e9bb11560e853041eacda2b5e88746331d1104b19a4f9"],
|
||||
"k_0_1": ["2f18558e5d3015cb6578aee1c3e4b645725fa4e1d26ce22cb31c9949f3b4957c"],
|
||||
"k_0_2": ["0a9d1dd7a5add91ebff4568ce089d2186f5cb6c5a8e5575a7911fa8ecdfbe812"],
|
||||
"k_0_3": ["764109deac38c18dddd859f5a00858d4a96ff581a6cc53b17690656d7a34f93c"],
|
||||
"k_0_4": ["da6c2426877e96589922557d776960ba128d5b1cea6c10cde5e13139e9995acb"],
|
||||
"k_0_5": ["0a97fa18f6b11103b75006601a8f0c172bf20f79b9e81c95c0e8a5209f9ca573"],
|
||||
"k_0_6": ["3f2403aee4715d46734dc026a6a6a095d417a6f15cb7144eb1ebdc8891ebb462"],
|
||||
"k_0_7": ["e44745af4355eac1eda621c8fd17668b2d9ab3329af51abf6f5dfb9baf637a07"],
|
||||
"k_0_8": ["947757dab98934e87c70171b67160777658eeccf9b74f3d6d9ad3f5ef14d0445"],
|
||||
"k_0_9": ["b8401c59efd8d163fadc70f39cb02abcd8f8682cc3d5bfa8663c967ea1a6b962"],
|
||||
"k_0_10": [
|
||||
"92edcb3e9da95893192481594ee8e9bef02e941bdf6e957731de967d2265fae6"
|
||||
],
|
||||
"k_0_11": ["9dab36382b9ad792fb07816c6196a30a94c33f62814972da06552614ce97eb3a"]
|
||||
};
|
||||
final Map<String, List<dynamic>> historyBatchArgs2 = {
|
||||
"k_0_0": ["dc64e048a76a88a721abe8b1e53d5a44bbbc83ff9b29449dffcd176d43e36e84"],
|
||||
"s_0_0": ["5d2a7a01f09f3e1df3fb44d25cc53cfd4e6df25b9c3e3f710f4dbc3e2be3a8fc"],
|
||||
"w_0_0": ["8e33ea48a5fabb82e44e9bb11560e853041eacda2b5e88746331d1104b19a4f9"],
|
||||
"k_0_1": ["06593b2d896751e8dda288bb6587b6bb6a1dee71d82a85457f5654f781e37b12"],
|
||||
"s_0_1": ["26f92666caebb9a17b14f5b573b385348cdc80065472b8961091f3226d2f650f"],
|
||||
"w_0_1": ["2f18558e5d3015cb6578aee1c3e4b645725fa4e1d26ce22cb31c9949f3b4957c"],
|
||||
"k_0_2": ["1478257da775ac14cc1120d022999fd35a8f51d5037e6fc11a17ca3dff43a28b"],
|
||||
"s_0_2": ["20eef9f15b0707cb5779f077dadcaf0be96e7212f76557f96e5dc5fb2e5aafa7"],
|
||||
"w_0_2": ["0a9d1dd7a5add91ebff4568ce089d2186f5cb6c5a8e5575a7911fa8ecdfbe812"],
|
||||
"k_0_3": ["69e435cb8ba991d2aced5b62271dcd40f0d3b19c38f19d5bc837231b3aef8475"],
|
||||
"s_0_3": ["eca08355027cb9f27500ea2588ee532b87b1061f1931b00b57244efad2081b99"],
|
||||
"w_0_3": ["764109deac38c18dddd859f5a00858d4a96ff581a6cc53b17690656d7a34f93c"],
|
||||
"k_0_4": ["a91771ce1cde7467c044c99165c3bc3239f402d18fe4e0eaf69ddf954f9545b4"],
|
||||
"s_0_4": ["f85fb2cfd89ca882aa93546ce5c6aaed7eb13bd60417822dbfe8514eaa32260d"],
|
||||
"w_0_4": ["da6c2426877e96589922557d776960ba128d5b1cea6c10cde5e13139e9995acb"],
|
||||
"k_0_5": ["d9d5e8d9b3090e310a40fb7ef3a398fbab300df4c4a3f729f7134caae2027a20"],
|
||||
"s_0_5": ["4e87132185225b4c79d69ca74a1d1ea329b0864af2b2b216c126fda4dfe44bc3"],
|
||||
"w_0_5": ["0a97fa18f6b11103b75006601a8f0c172bf20f79b9e81c95c0e8a5209f9ca573"],
|
||||
"k_0_6": ["29099731133ee2536a4f180e618e39669b7ae97867840736e02929d642ae05c9"],
|
||||
"s_0_6": ["46ade50d7c161264887d93ea77aa86d01c74ce296ce4d6f44a97c82b4023bf5d"],
|
||||
"w_0_6": ["3f2403aee4715d46734dc026a6a6a095d417a6f15cb7144eb1ebdc8891ebb462"],
|
||||
"k_0_7": ["9c898b834aeb60230a0c13ce1eec9efad0f6045a5ca4243287ab4c2d8c5484fe"],
|
||||
"s_0_7": ["22ff3049e6ef43f20289b0ac8c8480c61b5502b32e07d5bb57fa8029d6943596"],
|
||||
"w_0_7": ["e44745af4355eac1eda621c8fd17668b2d9ab3329af51abf6f5dfb9baf637a07"],
|
||||
"k_0_8": ["c1d5dfc51ae2bd98c3d7f61ca5187ba414e5aee7f11bbdb20685e66dfa758a63"],
|
||||
"s_0_8": ["01c387618378a58c221b51ab65a7f8e95a6932cdb0a8634acfe62acee1cb6cdc"],
|
||||
"w_0_8": ["947757dab98934e87c70171b67160777658eeccf9b74f3d6d9ad3f5ef14d0445"],
|
||||
"k_0_9": ["1335353bad1e12a2954ffdcc74d734d062a43c9750b7aee7eaa60bfd315fe0a4"],
|
||||
"s_0_9": ["51928f94d8c56318810e604dfb7b4862755ce5b005ec4242ea46a485e356d24f"],
|
||||
"w_0_9": ["b8401c59efd8d163fadc70f39cb02abcd8f8682cc3d5bfa8663c967ea1a6b962"],
|
||||
"k_0_10": [
|
||||
"77a9b30ea64e6ea73566b850f39c792cc7e31e3134831860b3a7582372036029"
|
||||
],
|
||||
"s_0_10": [
|
||||
"8ea9acdeaa65f2d99ed93a3b0691601e768f6695fb46cd9b1edc0bca10406767"
|
||||
],
|
||||
"w_0_10": [
|
||||
"92edcb3e9da95893192481594ee8e9bef02e941bdf6e957731de967d2265fae6"
|
||||
],
|
||||
"k_0_11": [
|
||||
"f9692ce7c5edf102c891a980c732e2c058694cc9a5bcc92994175f8c21eed6ae"
|
||||
],
|
||||
"s_0_11": [
|
||||
"7cda59a23e03a997b852df04c8368a0e7dba6583b87855c6dbe857254e28805e"
|
||||
],
|
||||
"w_0_11": ["9dab36382b9ad792fb07816c6196a30a94c33f62814972da06552614ce97eb3a"]
|
||||
"k_0_11": ["f9692ce7c5edf102c891a980c732e2c058694cc9a5bcc92994175f8c21eed6ae"]
|
||||
};
|
||||
final Map<String, List<dynamic>> historyBatchArgs1 = {
|
||||
final Map<String, List<dynamic>> historyBatchArgs3 = {
|
||||
"k_0_0": ["edf1976568f1aa676482c1882d44617a60476a1ceb92dd553143d43b9d44b32a"],
|
||||
"s_0_0": ["02f31c1a078f4c8c18321538fe8213b4289f9a24e7718096b6e92969438e110f"],
|
||||
"w_0_0": ["269df6359accfa9b761f22c42bd10dcda6fbc6ad708476d2e1efd4b3aa3f6e2f"],
|
||||
"k_0_1": ["bf5a6c56814e80eed11e1e459801515f8c2b83da812568aa9dc26e6356f6965b"],
|
||||
"s_0_1": ["11663d093cb17dfbed4a96d148b22d3e094b31d23c639c2814beb79f2ab0ca75"],
|
||||
"w_0_1": ["a328ae88ebce63c0010709ae900c199df2b585cdebce53a6291886dfdcc28c63"],
|
||||
"k_0_2": ["c10be67f5a01256e4c84fc9ed3f2b9f98b2ef20cf27b4ea908bd7aafb1d1f023"],
|
||||
"s_0_2": ["11f1b4a8d257d865abd2f2a48e779f699c7db528f83ad85d9182156580b5b198"],
|
||||
"w_0_2": ["16a765b755fcd070f5196f5a31d6370a799c5f2adac922bff8768f1c4e710b25"],
|
||||
"k_0_3": ["ce24ba1237e2306f7348f5f02e33c66c73c36c09b026ab4f08ef22f9b8a1e984"],
|
||||
"s_0_3": ["4fed678c085df3073ac86ea88d70f01d6d2a27d48230935b0514c07400b9aa57"],
|
||||
"w_0_3": ["f3baba5f725918c2038e7a80539088b2c0c636c6a27afb52b94b908241c7a5f8"],
|
||||
"k_0_4": ["f040d5195d547fc75660ef85417728ffbab6911dea95c49e28c56c589a2d7d9e"],
|
||||
"s_0_4": ["08598648eaa4193eeedfccb5b98fd291927d762481e637d3fc3633b826f1d11b"],
|
||||
"w_0_4": ["e72d39bd9e7b455503a2acae33647cb5ce33c1dc99ef9ebed0e7501b5e387f86"],
|
||||
"k_0_5": ["9766272abb45b0de891ad0f8492a5131e0e5ebc0072b9c1efb23303046bd05a5"],
|
||||
"s_0_5": ["b5d735762cc4caec5a9445b62e9cdb2219a4d34be9fdf021c7831635e74b22ca"],
|
||||
"w_0_5": ["7d9beb602c191843af7e0aef8d588f01bb9c5e2252a3eb29d92bb05833f924df"],
|
||||
"k_0_6": ["e6844bc07ae8834056698ad30d0ada23bec769fdd0b5ffbe20626c7d8693000a"],
|
||||
"s_0_6": ["8ad2f479c64645d16e6a67f0f8532f621b43c7be8b9ba3cf9a52b36572761900"],
|
||||
"w_0_6": ["6ab497d1554279dc0723ba1513ff687991454e6f720a79de2c1403b0de7fef73"],
|
||||
"k_0_7": ["ebff62957000f362d807db28b21af89a5bc9347346fc6434b2fe4e31e1b8dd7c"],
|
||||
"s_0_7": ["90cf90aef62db7572cb000fe718141bb46086610bbe72779393999f427bef381"],
|
||||
"w_0_7": ["fb33f2529224ddbb65056dd98296f5b9aad5fd31d2ec4db51520e38809d4ec38"],
|
||||
"k_0_8": ["51c818cf59c11676df096f5759d0d0c098baefe4e6fd240587cf7d751fe5ef8c"],
|
||||
"s_0_8": ["21090d0c982699238e4261ae6caa45785e18f0c389e0aa36f708ba88edc0655c"],
|
||||
"w_0_8": ["e7cb000615b4ecf2d483279fa437f37acd9deab1e9f3f4e94d4419c33e521753"],
|
||||
"k_0_9": ["3c942fe69ce42a2f59c94d2365fb805988e6e3e72376ff658a6aa0a926e1ff79"],
|
||||
"s_0_9": ["e446fec7b44710407d1bdd531578916c28333c75553aa6384c74f1474eff758a"],
|
||||
"w_0_9": ["d07ba311749923b3d6c2a291a3be9bcaf43e1fb1b97cb1b262c93672eda50823"],
|
||||
"k_0_10": [
|
||||
"fb29e1b177589820ad4685cc2fa555f170d885366f5046fd043b1891a43fa8ec"
|
||||
],
|
||||
"s_0_10": [
|
||||
"k_0_11": ["e0b955a5d5bde05cb45e0c7ba95afa8e3e09b04a2cab70e8f1383258471d089a"]
|
||||
};
|
||||
final Map<String, List<dynamic>> historyBatchArgs4 = {
|
||||
"k_0_0": ["02f31c1a078f4c8c18321538fe8213b4289f9a24e7718096b6e92969438e110f"],
|
||||
"k_0_1": ["11663d093cb17dfbed4a96d148b22d3e094b31d23c639c2814beb79f2ab0ca75"],
|
||||
"k_0_2": ["11f1b4a8d257d865abd2f2a48e779f699c7db528f83ad85d9182156580b5b198"],
|
||||
"k_0_3": ["4fed678c085df3073ac86ea88d70f01d6d2a27d48230935b0514c07400b9aa57"],
|
||||
"k_0_4": ["08598648eaa4193eeedfccb5b98fd291927d762481e637d3fc3633b826f1d11b"],
|
||||
"k_0_5": ["b5d735762cc4caec5a9445b62e9cdb2219a4d34be9fdf021c7831635e74b22ca"],
|
||||
"k_0_6": ["8ad2f479c64645d16e6a67f0f8532f621b43c7be8b9ba3cf9a52b36572761900"],
|
||||
"k_0_7": ["90cf90aef62db7572cb000fe718141bb46086610bbe72779393999f427bef381"],
|
||||
"k_0_8": ["21090d0c982699238e4261ae6caa45785e18f0c389e0aa36f708ba88edc0655c"],
|
||||
"k_0_9": ["e446fec7b44710407d1bdd531578916c28333c75553aa6384c74f1474eff758a"],
|
||||
"k_0_10": [
|
||||
"fd1564d56943bd604d0c246c1e5ab1edc8d3c8152ffea3c519aec8c300731517"
|
||||
],
|
||||
"w_0_10": [
|
||||
"cae047098603b4f4dedb5a5f7f3a0e0f6f0233eed8e0c06f47855c11ccf0a664"
|
||||
"k_0_11": ["b67bc093b3b10d3aad39ef94e161a5fb4ad72bec0a3423d33c7fbc063e1016cc"]
|
||||
};
|
||||
final Map<String, List<dynamic>> historyBatchArgs5 = {
|
||||
"k_0_0": ["5d2a7a01f09f3e1df3fb44d25cc53cfd4e6df25b9c3e3f710f4dbc3e2be3a8fc"],
|
||||
"k_0_1": ["26f92666caebb9a17b14f5b573b385348cdc80065472b8961091f3226d2f650f"],
|
||||
"k_0_2": ["20eef9f15b0707cb5779f077dadcaf0be96e7212f76557f96e5dc5fb2e5aafa7"],
|
||||
"k_0_3": ["eca08355027cb9f27500ea2588ee532b87b1061f1931b00b57244efad2081b99"],
|
||||
"k_0_4": ["f85fb2cfd89ca882aa93546ce5c6aaed7eb13bd60417822dbfe8514eaa32260d"],
|
||||
"k_0_5": ["4e87132185225b4c79d69ca74a1d1ea329b0864af2b2b216c126fda4dfe44bc3"],
|
||||
"k_0_6": ["46ade50d7c161264887d93ea77aa86d01c74ce296ce4d6f44a97c82b4023bf5d"],
|
||||
"k_0_7": ["22ff3049e6ef43f20289b0ac8c8480c61b5502b32e07d5bb57fa8029d6943596"],
|
||||
"k_0_8": ["01c387618378a58c221b51ab65a7f8e95a6932cdb0a8634acfe62acee1cb6cdc"],
|
||||
"k_0_9": ["51928f94d8c56318810e604dfb7b4862755ce5b005ec4242ea46a485e356d24f"],
|
||||
"k_0_10": [
|
||||
"8ea9acdeaa65f2d99ed93a3b0691601e768f6695fb46cd9b1edc0bca10406767"
|
||||
],
|
||||
"k_0_11": [
|
||||
"e0b955a5d5bde05cb45e0c7ba95afa8e3e09b04a2cab70e8f1383258471d089a"
|
||||
],
|
||||
"s_0_11": [
|
||||
"b67bc093b3b10d3aad39ef94e161a5fb4ad72bec0a3423d33c7fbc063e1016cc"
|
||||
],
|
||||
"w_0_11": ["6bdefed2a12896dd9840efd83c265e08f9131406c98839d4089377f517cbb977"]
|
||||
"k_0_11": ["7cda59a23e03a997b852df04c8368a0e7dba6583b87855c6dbe857254e28805e"]
|
||||
};
|
||||
|
||||
final Map<String, List<Map<String, dynamic>>> historyBatchResponse = {
|
||||
|
@ -172,3 +172,12 @@ final Map<String, List<Map<String, dynamic>>> emptyHistoryBatchResponse = {
|
|||
"s_0_11": [],
|
||||
"w_0_11": []
|
||||
};
|
||||
|
||||
final List<String> activeScriptHashes = [
|
||||
"11663d093cb17dfbed4a96d148b22d3e094b31d23c639c2814beb79f2ab0ca75",
|
||||
"06593b2d896751e8dda288bb6587b6bb6a1dee71d82a85457f5654f781e37b12",
|
||||
"a328ae88ebce63c0010709ae900c199df2b585cdebce53a6291886dfdcc28c63",
|
||||
"26f92666caebb9a17b14f5b573b385348cdc80065472b8961091f3226d2f650f",
|
||||
"2f18558e5d3015cb6578aee1c3e4b645725fa4e1d26ce22cb31c9949f3b4957c",
|
||||
"bf5a6c56814e80eed11e1e459801515f8c2b83da812568aa9dc26e6356f6965b",
|
||||
];
|
||||
|
|
|
@ -15,6 +15,7 @@ import 'package:stackwallet/services/price.dart';
|
|||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import 'bitcoin_history_sample_data.dart';
|
||||
import 'bitcoin_transaction_data_samples.dart';
|
||||
|
@ -2233,6 +2234,14 @@ void main() {
|
|||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs2))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs4))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
// await DB.instance.init();
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
bool hasThrown = false;
|
||||
|
@ -2250,6 +2259,10 @@ void main() {
|
|||
verify(client?.getServerFeatures()).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs0)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs2)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs3)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs4)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs5)).called(1);
|
||||
|
||||
expect(secureStore?.interactions, 20);
|
||||
expect(secureStore?.writes, 7);
|
||||
|
@ -2276,6 +2289,14 @@ void main() {
|
|||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs2))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs4))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
|
||||
|
@ -2290,6 +2311,10 @@ void main() {
|
|||
verify(client?.getServerFeatures()).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs0)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs2)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs3)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs4)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs5)).called(1);
|
||||
|
||||
verifyNoMoreInteractions(client);
|
||||
verifyNoMoreInteractions(cachedClient);
|
||||
|
@ -2312,8 +2337,27 @@ void main() {
|
|||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs2))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs4))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
List<dynamic> dynamicArgValues = [];
|
||||
|
||||
when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
.thenAnswer((realInvocation) async {
|
||||
if (realInvocation.namedArguments.values.first.length == 1) {
|
||||
dynamicArgValues.add(realInvocation.namedArguments.values.first);
|
||||
}
|
||||
|
||||
return historyBatchResponse;
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
bool hasThrown = false;
|
||||
try {
|
||||
|
@ -2330,6 +2374,18 @@ void main() {
|
|||
verify(client?.getServerFeatures()).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs0)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs2)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs3)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs4)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs5)).called(1);
|
||||
|
||||
for (final arg in dynamicArgValues) {
|
||||
final map = Map<String, List<dynamic>>.from(arg as Map);
|
||||
|
||||
verify(client?.getBatchHistory(args: map)).called(1);
|
||||
expect(activeScriptHashes.contains(map.values.first.first as String),
|
||||
true);
|
||||
}
|
||||
|
||||
expect(secureStore?.interactions, 14);
|
||||
expect(secureStore?.writes, 7);
|
||||
|
@ -2356,10 +2412,29 @@ void main() {
|
|||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs2))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs4))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(cachedClient?.clearSharedTransactionCache(coin: Coin.bitcoin))
|
||||
.thenAnswer((realInvocation) async {});
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
List<dynamic> dynamicArgValues = [];
|
||||
|
||||
when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
.thenAnswer((realInvocation) async {
|
||||
if (realInvocation.namedArguments.values.first.length == 1) {
|
||||
dynamicArgValues.add(realInvocation.namedArguments.values.first);
|
||||
}
|
||||
|
||||
return historyBatchResponse;
|
||||
});
|
||||
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// restore so we have something to rescan
|
||||
await btc?.recoverFromMnemonic(
|
||||
|
@ -2491,9 +2566,21 @@ void main() {
|
|||
verify(client?.getServerFeatures()).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs0)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs2)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs3)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs4)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs5)).called(2);
|
||||
verify(cachedClient?.clearSharedTransactionCache(coin: Coin.bitcoin))
|
||||
.called(1);
|
||||
|
||||
for (final arg in dynamicArgValues) {
|
||||
final map = Map<String, List<dynamic>>.from(arg as Map);
|
||||
|
||||
verify(client?.getBatchHistory(args: map)).called(1);
|
||||
expect(activeScriptHashes.contains(map.values.first.first as String),
|
||||
true);
|
||||
}
|
||||
|
||||
expect(secureStore?.writes, 25);
|
||||
expect(secureStore?.reads, 32);
|
||||
expect(secureStore?.deletes, 6);
|
||||
|
@ -2519,10 +2606,29 @@ void main() {
|
|||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs2))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs4))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(cachedClient?.clearSharedTransactionCache(coin: Coin.bitcoin))
|
||||
.thenAnswer((realInvocation) async {});
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
List<dynamic> dynamicArgValues = [];
|
||||
|
||||
when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
.thenAnswer((realInvocation) async {
|
||||
if (realInvocation.namedArguments.values.first.length == 1) {
|
||||
dynamicArgValues.add(realInvocation.namedArguments.values.first);
|
||||
}
|
||||
|
||||
return historyBatchResponse;
|
||||
});
|
||||
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// restore so we have something to rescan
|
||||
await btc?.recoverFromMnemonic(
|
||||
|
@ -2624,10 +2730,22 @@ void main() {
|
|||
|
||||
verify(client?.getServerFeatures()).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs0)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs2)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs3)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs4)).called(2);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs5)).called(2);
|
||||
verify(cachedClient?.clearSharedTransactionCache(coin: Coin.bitcoin))
|
||||
.called(1);
|
||||
|
||||
for (final arg in dynamicArgValues) {
|
||||
final map = Map<String, List<dynamic>>.from(arg as Map);
|
||||
|
||||
verify(client?.getBatchHistory(args: map)).called(1);
|
||||
expect(activeScriptHashes.contains(map.values.first.first as String),
|
||||
true);
|
||||
}
|
||||
|
||||
expect(secureStore?.writes, 19);
|
||||
expect(secureStore?.reads, 32);
|
||||
expect(secureStore?.deletes, 12);
|
||||
|
@ -3911,8 +4029,27 @@ void main() {
|
|||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs2))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs4))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
List<dynamic> dynamicArgValues = [];
|
||||
|
||||
when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
.thenAnswer((realInvocation) async {
|
||||
if (realInvocation.namedArguments.values.first.length == 1) {
|
||||
dynamicArgValues.add(realInvocation.namedArguments.values.first);
|
||||
}
|
||||
|
||||
return historyBatchResponse;
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
when(cachedClient?.getTransaction(
|
||||
txHash:
|
||||
|
@ -3995,6 +4132,18 @@ void main() {
|
|||
// .called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs0)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs2)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs3)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs4)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs5)).called(1);
|
||||
|
||||
for (final arg in dynamicArgValues) {
|
||||
final map = Map<String, List<dynamic>>.from(arg as Map);
|
||||
|
||||
verify(client?.getBatchHistory(args: map)).called(1);
|
||||
expect(activeScriptHashes.contains(map.values.first.first as String),
|
||||
true);
|
||||
}
|
||||
|
||||
expect(secureStore?.interactions, 20);
|
||||
expect(secureStore?.writes, 10);
|
||||
|
@ -4169,8 +4318,27 @@ void main() {
|
|||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs2))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs4))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
List<dynamic> dynamicArgValues = [];
|
||||
|
||||
when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
.thenAnswer((realInvocation) async {
|
||||
if (realInvocation.namedArguments.values.first.length == 1) {
|
||||
dynamicArgValues.add(realInvocation.namedArguments.values.first);
|
||||
}
|
||||
|
||||
return historyBatchResponse;
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// recover to fill data
|
||||
await btc?.recoverFromMnemonic(
|
||||
|
@ -4186,6 +4354,18 @@ void main() {
|
|||
verify(client?.getServerFeatures()).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs0)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs2)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs3)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs4)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs5)).called(1);
|
||||
|
||||
for (final arg in dynamicArgValues) {
|
||||
final map = Map<String, List<dynamic>>.from(arg as Map);
|
||||
|
||||
verify(client?.getBatchHistory(args: map)).called(1);
|
||||
expect(activeScriptHashes.contains(map.values.first.first as String),
|
||||
true);
|
||||
}
|
||||
|
||||
expect(secureStore?.interactions, 14);
|
||||
expect(secureStore?.writes, 7);
|
||||
|
@ -4198,8 +4378,9 @@ void main() {
|
|||
verifyNoMoreInteractions(priceAPI);
|
||||
});
|
||||
|
||||
test("refresh wallet throws", () async {
|
||||
when(client?.getBlockHeadTip()).thenThrow(Exception("some exception"));
|
||||
test("refresh wallet normally", () async {
|
||||
when(client?.getBlockHeadTip()).thenAnswer((realInvocation) async =>
|
||||
{"height": 520481, "hex": "some block hex"});
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"pruning": null,
|
||||
|
@ -4210,14 +4391,23 @@ void main() {
|
|||
"hash_function": "sha256",
|
||||
"services": []
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenThrow(Exception("some exception"));
|
||||
.thenAnswer((_) async => []);
|
||||
when(client?.estimateFee(blocks: anyNamed("blocks")))
|
||||
.thenAnswer((_) async => Decimal.one);
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
when(priceAPI?.getPricesAnd24hChange(baseCurrency: "USD"))
|
||||
.thenAnswer((_) async => {Coin.bitcoin: Tuple2(Decimal.one, 0.3)});
|
||||
|
||||
final List<dynamic> dynamicArgValues = [];
|
||||
|
||||
when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
.thenAnswer((realInvocation) async {
|
||||
dynamicArgValues.add(realInvocation.namedArguments.values.first);
|
||||
return historyBatchResponse;
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// recover to fill data
|
||||
await btc?.recoverFromMnemonic(
|
||||
|
@ -4226,83 +4416,35 @@ void main() {
|
|||
maxNumberOfIndexesToCheck: 1000,
|
||||
height: 4000);
|
||||
|
||||
when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
.thenAnswer((_) async => {});
|
||||
when(client?.getBatchUTXOs(args: anyNamed("args")))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
||||
await btc?.refresh();
|
||||
|
||||
verify(client?.getServerFeatures()).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs0)).called(1);
|
||||
verify(client?.getBatchHistory(args: historyBatchArgs1)).called(1);
|
||||
verify(client?.getHistory(scripthash: anyNamed("scripthash"))).called(4);
|
||||
verify(client?.estimateFee(blocks: anyNamed("blocks"))).called(3);
|
||||
verify(client?.getBlockHeadTip()).called(1);
|
||||
verify(client?.getHistory(scripthash: anyNamed("scripthash"))).called(1);
|
||||
verify(priceAPI?.getPricesAnd24hChange(baseCurrency: "USD")).called(2);
|
||||
|
||||
for (final arg in dynamicArgValues) {
|
||||
final map = Map<String, List<dynamic>>.from(arg as Map);
|
||||
|
||||
verify(client?.getBatchHistory(args: map)).called(1);
|
||||
}
|
||||
|
||||
expect(secureStore?.interactions, 14);
|
||||
expect(secureStore?.writes, 7);
|
||||
expect(secureStore?.reads, 7);
|
||||
expect(secureStore?.deletes, 0);
|
||||
|
||||
verifyNoMoreInteractions(client);
|
||||
// verifyNoMoreInteractions(client);
|
||||
verifyNoMoreInteractions(cachedClient);
|
||||
verifyNoMoreInteractions(tracker);
|
||||
verifyNoMoreInteractions(priceAPI);
|
||||
});
|
||||
|
||||
// test("refresh wallet normally", () async {
|
||||
// when(client?.getBlockHeadTip()).thenAnswer((realInvocation) async =>
|
||||
// {"height": 520481, "hex": "some block hex"});
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
// when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
// .thenAnswer((_) async => []);
|
||||
// when(client?.estimateFee(blocks: anyNamed("blocks")))
|
||||
// .thenAnswer((_) async => Decimal.one);
|
||||
// // when(priceAPI.getBitcoinPrice(baseCurrency: "USD"))
|
||||
// // .thenAnswer((_) async => Decimal.one);
|
||||
//
|
||||
// // recover to fill data
|
||||
// await btc?.recoverFromMnemonic(
|
||||
// mnemonic: TEST_MNEMONIC,
|
||||
// maxUnusedAddressGap: 2,
|
||||
// maxNumberOfIndexesToCheck: 1000,
|
||||
// height: 4000);
|
||||
//
|
||||
// when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
// .thenAnswer((_) async => {});
|
||||
// when(client?.getBatchUTXOs(args: anyNamed("args")))
|
||||
// .thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
//
|
||||
// await btc?.refresh();
|
||||
//
|
||||
// verify(client?.getServerFeatures()).called(1);
|
||||
// verify(client?.getBatchHistory(args: historyBatchArgs0)).called(1);
|
||||
// verify(client?.getBatchHistory(args: historyBatchArgs1)).called(1);
|
||||
// verify(client?.getBatchHistory(args: anyNamed("args"))).called(1);
|
||||
// verify(client?.getBatchUTXOs(args: anyNamed("args"))).called(1);
|
||||
// verify(client?.getHistory(scripthash: anyNamed("scripthash"))).called(4);
|
||||
// verify(client?.estimateFee(blocks: anyNamed("blocks"))).called(3);
|
||||
// verify(client?.getBlockHeadTip()).called(1);
|
||||
// // verify(priceAPI.getBitcoinPrice(baseCurrency: "USD")).called(2);
|
||||
//
|
||||
// expect(secureStore?.interactions, 14);
|
||||
// expect(secureStore?.writes, 7);
|
||||
// expect(secureStore?.reads, 7);
|
||||
// expect(secureStore?.deletes, 0);
|
||||
//
|
||||
// verifyNoMoreInteractions(client);
|
||||
// verifyNoMoreInteractions(cachedClient);
|
||||
// verifyNoMoreInteractions(priceAPI);
|
||||
// });
|
||||
|
||||
tearDown(() async {
|
||||
await tearDownTestHive();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue