Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,60 @@ jobs:
run: git submodule update --init --recursive
- name: Get dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Create temp files
id: secret-file1
run: |
$secretFileExchange = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "lib/external_api_keys.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:CHANGE_NOW);
Set-Content $secretFileExchange -Value $encodedBytes -AsByteStream;
$secretFileExchangeHash = Get-FileHash $secretFileExchange;
Write-Output "::set-output name=SECRET_FILE_EXCHANGE::$secretFileExchange";
Write-Output "::set-output name=SECRET_FILE_EXCHANGE_HASH::$($secretFileExchangeHash.Hash)";
Write-Output "Secret file $secretFileExchange has hash $($secretFileExchangeHash.Hash)";

$secretFileBitcoin = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "test/services/coins/bitcoin/bitcoin_wallet_test_parameters.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:BITCOIN_TEST);
Set-Content $secretFileBitcoin -Value $encodedBytes -AsByteStream;
$secretFileBitcoinHash = Get-FileHash $secretFileBitcoin;
Write-Output "::set-output name=SECRET_FILE_BITCOIN::$secretFileBitcoin";
Write-Output "::set-output name=SECRET_FILE_BITCOIN_HASH::$($secretFileBitcoinHash.Hash)";
Write-Output "Secret file $secretFileBitcoin has hash $($secretFileBitcoinHash.Hash)";

$secretFileDogecoin = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "test/services/coins/dogecoin/dogecoin_wallet_test_parameters.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:DOGECOIN_TEST);
Set-Content $secretFileDogecoin -Value $encodedBytes -AsByteStream;
$secretFileDogecoinHash = Get-FileHash $secretFileDogecoin;
Write-Output "::set-output name=SECRET_FILE_DOGECOIN::$secretFileDogecoin";
Write-Output "::set-output name=SECRET_FILE_DOGECOIN_HASH::$($secretFileDogecoinHash.Hash)";
Write-Output "Secret file $secretFileDogecoin has hash $($secretFileDogecoinHash.Hash)";

$secretFileFiro = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "test/services/coins/firo/firo_wallet_test_parameters.dart";
$encodedBytes = [System.Convert]::FromBase64String($env:FIRO_TEST);
Set-Content $secretFileFiro -Value $encodedBytes -AsByteStream;
$secretFileFiroHash = Get-FileHash $secretFileFiro;
Write-Output "::set-output name=SECRET_FILE_FIRO::$secretFileFiro";
Write-Output "::set-output name=SECRET_FILE_FIRO_HASH::$($secretFileFiroHash.Hash)";
Write-Output "Secret file $secretFileFiro has hash $($secretFileFiroHash.Hash)";
shell: pwsh
env:
CHANGE_NOW: ${{ secrets.CHANGE_NOW }}
BITCOIN_TEST: ${{ secrets.BITCOIN_TEST }}
DOGECOIN_TEST: ${{ secrets.DOGECOIN_TEST }}
FIRO_TEST: ${{ secrets.FIRO_TEST }}
# - name: Analyze
# run: flutter analyze
- name: Test
run: flutter test
- name: Delete temp files
run: |
Remove-Item -Path $env:CHANGE_NOW;
Remove-Item -Path $env:BITCOIN_TEST;
Remove-Item -Path $env:DOGECOIN_TEST;
Remove-Item -Path $env:FIRO_TEST;
shell: pwsh
if: always()
env:
CHANGE_NOW: ${{ steps.secret-file1.outputs.SECRET_FILE_EXCHANGE }}
BITCOIN_TEST: ${{ steps.secret-file1.outputs.SECRET_FILE_BITCOIN }}
DOGECOIN_TEST: ${{ steps.secret-file1.outputs.SECRET_FILE_DOGECOIN }}
FIRO_TEST: ${{ steps.secret-file1.outputs.SECRET_FILE_FIRO }}
306 changes: 158 additions & 148 deletions test/screen_tests/lockscreen_view_screen_test.mocks.dart

Large diffs are not rendered by default.

306 changes: 158 additions & 148 deletions test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart

Large diffs are not rendered by default.

274 changes: 142 additions & 132 deletions test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
// in stackwallet/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.dart.
// Do not manually edit this file.

import 'dart:async' as _i4;
import 'dart:ui' as _i6;
import 'dart:async' as _i5;
import 'dart:ui' as _i7;

import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/models/node_model.dart' as _i3;
import 'package:stackwallet/services/node_service.dart' as _i2;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i5;
import 'package:stackwallet/models/node_model.dart' as _i4;
import 'package:stackwallet/services/node_service.dart' as _i3;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6;
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
as _i2;

// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
Expand All @@ -20,31 +22,39 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i5;
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types

class _FakeFlutterSecureStorageInterface_0 extends _i1.Fake
implements _i2.FlutterSecureStorageInterface {}

/// A class which mocks [NodeService].
///
/// See the documentation for Mockito's code generation for more information.
class MockNodeService extends _i1.Mock implements _i2.NodeService {
class MockNodeService extends _i1.Mock implements _i3.NodeService {
@override
_i2.FlutterSecureStorageInterface get secureStorageInterface =>
(super.noSuchMethod(Invocation.getter(#secureStorageInterface),
returnValue: _FakeFlutterSecureStorageInterface_0())
as _i2.FlutterSecureStorageInterface);
@override
List<_i3.NodeModel> get primaryNodes =>
List<_i4.NodeModel> get primaryNodes =>
(super.noSuchMethod(Invocation.getter(#primaryNodes),
returnValue: <_i3.NodeModel>[]) as List<_i3.NodeModel>);
returnValue: <_i4.NodeModel>[]) as List<_i4.NodeModel>);
@override
List<_i3.NodeModel> get nodes =>
List<_i4.NodeModel> get nodes =>
(super.noSuchMethod(Invocation.getter(#nodes),
returnValue: <_i3.NodeModel>[]) as List<_i3.NodeModel>);
returnValue: <_i4.NodeModel>[]) as List<_i4.NodeModel>);
@override
bool get hasListeners =>
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false)
as bool);
@override
_i4.Future<void> updateDefaults() =>
_i5.Future<void> updateDefaults() =>
(super.noSuchMethod(Invocation.method(#updateDefaults, []),
returnValue: Future<void>.value(),
returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>);
@override
_i4.Future<void> setPrimaryNodeFor(
{_i5.Coin? coin,
_i3.NodeModel? node,
_i5.Future<void> setPrimaryNodeFor(
{_i6.Coin? coin,
_i4.NodeModel? node,
bool? shouldNotifyListeners = false}) =>
(super.noSuchMethod(
Invocation.method(#setPrimaryNodeFor, [], {
Expand All @@ -53,62 +63,62 @@ class MockNodeService extends _i1.Mock implements _i2.NodeService {
#shouldNotifyListeners: shouldNotifyListeners
}),
returnValue: Future<void>.value(),
returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>);
@override
_i3.NodeModel? getPrimaryNodeFor({_i5.Coin? coin}) => (super.noSuchMethod(
_i4.NodeModel? getPrimaryNodeFor({_i6.Coin? coin}) => (super.noSuchMethod(
Invocation.method(#getPrimaryNodeFor, [], {#coin: coin}))
as _i3.NodeModel?);
as _i4.NodeModel?);
@override
List<_i3.NodeModel> getNodesFor(_i5.Coin? coin) =>
List<_i4.NodeModel> getNodesFor(_i6.Coin? coin) =>
(super.noSuchMethod(Invocation.method(#getNodesFor, [coin]),
returnValue: <_i3.NodeModel>[]) as List<_i3.NodeModel>);
returnValue: <_i4.NodeModel>[]) as List<_i4.NodeModel>);
@override
_i3.NodeModel? getNodeById({String? id}) =>
_i4.NodeModel? getNodeById({String? id}) =>
(super.noSuchMethod(Invocation.method(#getNodeById, [], {#id: id}))
as _i3.NodeModel?);
as _i4.NodeModel?);
@override
List<_i3.NodeModel> failoverNodesFor({_i5.Coin? coin}) => (super.noSuchMethod(
List<_i4.NodeModel> failoverNodesFor({_i6.Coin? coin}) => (super.noSuchMethod(
Invocation.method(#failoverNodesFor, [], {#coin: coin}),
returnValue: <_i3.NodeModel>[]) as List<_i3.NodeModel>);
returnValue: <_i4.NodeModel>[]) as List<_i4.NodeModel>);
@override
_i4.Future<void> add(
_i3.NodeModel? node, String? password, bool? shouldNotifyListeners) =>
_i5.Future<void> add(
_i4.NodeModel? node, String? password, bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(#add, [node, password, shouldNotifyListeners]),
returnValue: Future<void>.value(),
returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>);
@override
_i4.Future<void> delete(String? id, bool? shouldNotifyListeners) => (super
_i5.Future<void> delete(String? id, bool? shouldNotifyListeners) => (super
.noSuchMethod(Invocation.method(#delete, [id, shouldNotifyListeners]),
returnValue: Future<void>.value(),
returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>);
@override
_i4.Future<void> setEnabledState(
_i5.Future<void> setEnabledState(
String? id, bool? enabled, bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(
#setEnabledState, [id, enabled, shouldNotifyListeners]),
returnValue: Future<void>.value(),
returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>);
@override
_i4.Future<void> edit(_i3.NodeModel? editedNode, String? password,
_i5.Future<void> edit(_i4.NodeModel? editedNode, String? password,
bool? shouldNotifyListeners) =>
(super.noSuchMethod(
Invocation.method(
#edit, [editedNode, password, shouldNotifyListeners]),
returnValue: Future<void>.value(),
returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>);
@override
_i4.Future<void> updateCommunityNodes() =>
_i5.Future<void> updateCommunityNodes() =>
(super.noSuchMethod(Invocation.method(#updateCommunityNodes, []),
returnValue: Future<void>.value(),
returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>);
@override
void addListener(_i6.VoidCallback? listener) =>
void addListener(_i7.VoidCallback? listener) =>
super.noSuchMethod(Invocation.method(#addListener, [listener]),
returnValueForMissingStub: null);
@override
void removeListener(_i6.VoidCallback? listener) =>
void removeListener(_i7.VoidCallback? listener) =>
super.noSuchMethod(Invocation.method(#removeListener, [listener]),
returnValueForMissingStub: null);
@override
Expand Down
36 changes: 18 additions & 18 deletions test/services/coins/firo/firo_wallet_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,24 @@ void main() {
expect(result, 1);
});

test("isolateCreateJoinSplitTransaction success", () async {
final result = await isolateCreateJoinSplitTransaction(
9000,
"aNmsUtzPzQ3SKWNjEH48GacMQJXWN5Rotm",
true,
TEST_MNEMONIC,
2,
Decimal.ten,
SampleLelantus.lelantusEntries,
459185,
Coin.firo,
firoNetwork,
[GetAnonymitySetSampleData.data],
"en_US",
);

expect(result, isA<Map<String, dynamic>>());
});
// test("isolateCreateJoinSplitTransaction success", () async {
// final result = await isolateCreateJoinSplitTransaction(
// 9000,
// "aNmsUtzPzQ3SKWNjEH48GacMQJXWN5Rotm",
// true,
// TEST_MNEMONIC,
// 2,
// Decimal.ten,
// SampleLelantus.lelantusEntries,
// 459185,
// Coin.firo,
// firoNetwork,
// [GetAnonymitySetSampleData.data],
// "en_US",
// );
//
// expect(result, isA<Map<String, dynamic>>());
// });

test("isolateEstimateJoinSplitFee", () async {
final result = await isolateEstimateJoinSplitFee(
Expand Down
8 changes: 8 additions & 0 deletions test/services/coins/manager_test.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ class MockFiroWallet extends _i1.Mock implements _i7.FiroWallet {
returnValue: Future<void>.value(),
returnValueForMissingStub: Future<void>.value()) as _i8.Future<void>);
@override
_i8.Future<dynamic> GetCoinsToJoinSplit(int? required) =>
(super.noSuchMethod(Invocation.method(#GetCoinsToJoinSplit, [required]),
returnValue: Future<dynamic>.value()) as _i8.Future<dynamic>);
@override
_i8.Future<int> EstimateJoinSplitFee(int? spendAmount) => (super.noSuchMethod(
Invocation.method(#EstimateJoinSplitFee, [spendAmount]),
returnValue: Future<int>.value(0)) as _i8.Future<int>);
@override
_i8.Future<int> estimateFeeFor(int? satoshiAmount, int? feeRate) =>
(super.noSuchMethod(
Invocation.method(#estimateFeeFor, [satoshiAmount, feeRate]),
Expand Down
Loading