mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 06:38:52 +00:00
specify tests for 14 word seeds and add more error checking code to test
and update ref to flutter_libmonero enabling tests (mocked storage, etc)
This commit is contained in:
parent
65338ad87b
commit
6223df5432
3 changed files with 30 additions and 21 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 277d922c3b1d637c1ccda25f51395c618d293015
|
Subproject commit d92fea3e6b915b79697deafbd5710fb4c15bfc76
|
|
@ -83,13 +83,13 @@ void main() async {
|
||||||
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
|
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
|
||||||
walletService = wownero.createWowneroWalletService(_walletInfoSource);
|
walletService = wownero.createWowneroWalletService(_walletInfoSource);
|
||||||
|
|
||||||
group("Wownero tests", () {
|
group("Wownero 14 word tests", () {
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
try {
|
try {
|
||||||
final dirPath = await pathForWalletDir(name: name, type: type);
|
final dirPath = await pathForWalletDir(name: name, type: type);
|
||||||
path = await pathForWallet(name: name, type: type);
|
path = await pathForWallet(name: name, type: type);
|
||||||
credentials = wownero.createWowneroRestoreWalletFromSeedCredentials(
|
credentials = wownero.createWowneroRestoreWalletFromSeedCredentials(
|
||||||
name: name, height: 465760, mnemonic: testMnemonic);
|
name: name, height: 465760, mnemonic: testMnemonic14);
|
||||||
|
|
||||||
walletInfo = WalletInfo.external(
|
walletInfo = WalletInfo.external(
|
||||||
id: WalletBase.idFor(name, type),
|
id: WalletBase.idFor(name, type),
|
||||||
|
@ -116,27 +116,36 @@ void main() async {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Test mainnet address generation from seed", () async {
|
test("Test mainnet address generation from 14 word seed", () async {
|
||||||
final wallet = await _walletCreationService.restoreFromSeed(credentials);
|
final wallet = await _walletCreationService.restoreFromSeed(credentials);
|
||||||
walletInfo.address = wallet.walletAddresses.address;
|
walletInfo.address = wallet.walletAddresses.address;
|
||||||
|
|
||||||
await _walletInfoSource.add(walletInfo);
|
bool hasThrown = false;
|
||||||
|
try {
|
||||||
|
await _walletInfoSource.add(walletInfo);
|
||||||
|
walletBase?.close();
|
||||||
|
walletBase = wallet as WowneroWalletBase;
|
||||||
|
|
||||||
|
expect(walletInfo.address, mainnetTestData14[0][0]);
|
||||||
|
expect(
|
||||||
|
await walletBase!.getTransactionAddress(0, 0), mainnetTestData14[0][0]);
|
||||||
|
expect(
|
||||||
|
await walletBase!.getTransactionAddress(0, 1), mainnetTestData14[0][1]);
|
||||||
|
expect(
|
||||||
|
await walletBase!.getTransactionAddress(0, 2), mainnetTestData14[0][2]);
|
||||||
|
expect(
|
||||||
|
await walletBase!.getTransactionAddress(1, 0), mainnetTestData14[1][0]);
|
||||||
|
expect(
|
||||||
|
await walletBase!.getTransactionAddress(1, 1), mainnetTestData14[1][1]);
|
||||||
|
expect(
|
||||||
|
await walletBase!.getTransactionAddress(1, 2), mainnetTestData14[1][2]);
|
||||||
|
} catch (_) {
|
||||||
|
hasThrown = true;
|
||||||
|
}
|
||||||
|
expect(hasThrown, false);
|
||||||
|
|
||||||
walletBase?.close();
|
walletBase?.close();
|
||||||
walletBase = wallet as WowneroWalletBase;
|
walletBase = wallet as WowneroWalletBase;
|
||||||
|
|
||||||
expect(walletInfo.address, mainnetTestData[0][0]);
|
|
||||||
expect(
|
|
||||||
await walletBase!.getTransactionAddress(0, 0), mainnetTestData[0][0]);
|
|
||||||
expect(
|
|
||||||
await walletBase!.getTransactionAddress(0, 1), mainnetTestData[0][1]);
|
|
||||||
expect(
|
|
||||||
await walletBase!.getTransactionAddress(0, 2), mainnetTestData[0][2]);
|
|
||||||
expect(
|
|
||||||
await walletBase!.getTransactionAddress(1, 0), mainnetTestData[1][0]);
|
|
||||||
expect(
|
|
||||||
await walletBase!.getTransactionAddress(1, 1), mainnetTestData[1][1]);
|
|
||||||
expect(
|
|
||||||
await walletBase!.getTransactionAddress(1, 2), mainnetTestData[1][2]);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
String testMnemonic =
|
String testMnemonic14 =
|
||||||
'weather cruise school such silly profit clerk wage reduce obtain ill sand episode shadow';
|
'weather cruise school such silly profit clerk wage reduce obtain ill sand episode shadow';
|
||||||
var mainnetTestData = [
|
var mainnetTestData14 = [
|
||||||
[
|
[
|
||||||
'Wo3jmHvTMLwE6h29fpgcb8PbJSpaKuqM7XTXVfiiu8bLCZsJvrQCbQSJR48Vo3BWNQKsMsXZ4VixndXTH25QtorC27NCjmsEi',
|
'Wo3jmHvTMLwE6h29fpgcb8PbJSpaKuqM7XTXVfiiu8bLCZsJvrQCbQSJR48Vo3BWNQKsMsXZ4VixndXTH25QtorC27NCjmsEi',
|
||||||
'WW3K54QzmMFB1uTZh3LVvgQYqANLmX1FkJHLJ4sU1E7BQmp8nGizyBnjNXSgsjCa4BQ3Rw3GG5jw1ByUkaUjSywm2KmHAbFvK',
|
'WW3K54QzmMFB1uTZh3LVvgQYqANLmX1FkJHLJ4sU1E7BQmp8nGizyBnjNXSgsjCa4BQ3Rw3GG5jw1ByUkaUjSywm2KmHAbFvK',
|
||||||
|
|
Loading…
Reference in a new issue