ci: run analyze + tests on every push/PR; make the suite real

- delete the stock Flutter counter widget_test (always failed) and the
  lightning invoice tests (network-dependent, and the feature is off)
- fix rotted assertions: removed-chain wallet types (solana, tron, zano,
  decred) and mainnet-only BTC/LTC pattern expectations
- new test.yml workflow: pub get + analyze + test on push/PR to dev/main
- analysis_options: drop excludes for deleted paths, stop excluding the
  five live coin facades, enable empty_catches and 7 other correctness
  lints (still 0 analyzer errors)
- integration_test_runner: clean hash_wallet data dirs, not cake_wallet
This commit is contained in:
jwinterm
2026-08-15 16:28:44 -04:00
parent 08fb925cea
commit 77ae91e695
8 changed files with 93 additions and 151 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ void main() {
test('returns correct pattern for Bitcoin', () {
final pattern = AddressValidator.getPattern(CryptoCurrency.btc);
expect(pattern, isNotEmpty);
expect(pattern, contains('(bc|tb)1q'));
expect(pattern, contains('bc1q'));
});
test('returns correct pattern for Ethereum', () {
@@ -30,8 +30,8 @@ void main() {
test('returns correct pattern for Litecoin', () {
final pattern = AddressValidator.getPattern(CryptoCurrency.ltc);
expect(pattern, isNotEmpty);
expect(pattern,
contains('(bc|tb|ltc)1q[ac-hj-np-z02-9]{25,39}|(ltc|t)mweb1q[ac-hj-np-z02-9]{90,120}'));
expect(pattern, contains('ltc1q[ac-hj-np-z02-9]{25,39}'));
expect(pattern, contains('(ltc|t)mweb1q[ac-hj-np-z02-9]{90,120}'));
});
test('returns empty string for unknown currency', () {
@@ -1,31 +0,0 @@
import "package:hash_wallet/core/lightning_invoice_service.dart";
import "package:cw_core/lnurl.dart";
import "package:cw_core/utils/proxy_wrapper.dart";
import "package:cw_core/utils/tor/abstract.dart";
import "package:flutter_test/flutter_test.dart";
Future<void> main() async {
CakeTor.instance = await CakeTorInstance.getInstance();
group("lightning_invoice_service", () {
test("Should resolve an empty Bolt11 invoice konsti@cake.cash", () async {
final invoice = await getBolt11FromLightingAddress("konsti@cake.cash");
expect(invoice, isNotNull);
expect(isBolt11ZeroInvoice(invoice!), isTrue);
});
test("Should not resolve an empty Bolt11 invoice viksharma@cluborange.org", () async {
final invoice = await getBolt11FromLightingAddress("viksharma@cluborange.org");
expect(invoice, isNull);
});
test("Should resolve an Bolt11 invoice viksharma@cluborange.org", () async {
final invoice =
await getBolt11FromLightingAddress("viksharma@cluborange.org", amount: 1000000000);
expect(invoice, isNotNull);
});
});
}
@@ -171,30 +171,6 @@ void main() {
});
});
group('Solana Address Detection', () {
test('detects Solana address', () {
const address = '7TSTXnQZxQDA4JoNqs4DqVqE7oNWk2kmHkMT6DD6vw2S';
final result = UniversalAddressDetector.detectAddress(address);
expect(result.isValid, true);
expect(result.detectedCurrency, CryptoCurrency.sol);
expect(result.detectedWalletType, WalletType.solana);
expect(result.address, address);
});
});
group('Tron Address Detection', () {
test('detects Tron address', () {
const address = 'TF7yQKp7pwLBSXBXthcrXMqTyjtvkJK28V';
final result = UniversalAddressDetector.detectAddress(address);
expect(result.isValid, true);
expect(result.detectedCurrency, CryptoCurrency.trx);
expect(result.detectedWalletType, WalletType.tron);
expect(result.address, address);
});
});
group('Wownero Address Detection', () {
test('detects Wownero address', () {
const address =
@@ -208,41 +184,6 @@ void main() {
});
});
group('Zano Address Detection', () {
test('detects Zano address', () {
const address =
'ZxDREZKHjUAUkRpWrHV9AjJHe12RhtoY9TjUUx2EznNNdwJK9yiHEhuQkqGYnyDXRnFC3Uehu6kLGZmiQab8fWoQ1JrLsuJ1i';
final result = UniversalAddressDetector.detectAddress(address);
expect(result.isValid, true);
expect(result.detectedCurrency, CryptoCurrency.zano);
expect(result.detectedWalletType, WalletType.zano);
expect(result.address, address);
});
test('detects Zano alias', () {
const address = '@testuser';
final result = UniversalAddressDetector.detectAddress(address);
expect(result.isValid, true);
expect(result.detectedCurrency, CryptoCurrency.zano);
expect(result.detectedWalletType, WalletType.zano);
expect(result.address, address);
});
});
group('Decred Address Detection', () {
test('detects Decred address', () {
const address = 'DsW4ZtRV1DcPCuKXVVtGnCy3AtAZHg5N8nR';
final result = UniversalAddressDetector.detectAddress(address);
expect(result.isValid, true);
expect(result.detectedCurrency, CryptoCurrency.dcr);
expect(result.detectedWalletType, WalletType.decred);
expect(result.address, address);
});
});
group('Invalid Address Detection', () {
test('handles empty input', () {
const address = '';