From 5d97ed3fadf0f93c1bf08255cd8100975d83f377 Mon Sep 17 00:00:00 2001 From: Justin Moore Date: Wed, 16 Dec 2020 20:53:58 -0800 Subject: [PATCH] fix(wallet): hermit test suite updates --- src/tests/extendedPublicKeys.jsx | 4 ++++ src/tests/publicKeys.jsx | 5 ++++- src/tests/signing.jsx | 31 ++++++++++++++++++++++++------- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/tests/extendedPublicKeys.jsx b/src/tests/extendedPublicKeys.jsx index 5b0337df..e49584be 100644 --- a/src/tests/extendedPublicKeys.jsx +++ b/src/tests/extendedPublicKeys.jsx @@ -5,6 +5,7 @@ import { TREZOR, COLDCARD, ExportExtendedPublicKey, + HERMIT, } from "unchained-wallets"; import Test from "./Test"; @@ -43,6 +44,9 @@ class ExportExtendedPublicKeyTest extends Test { rootFingerprint, } = TEST_FIXTURES.keys.open_source.nodes[this.params.bip32Path]; + if (this.params.keystore === HERMIT) { + return { xpub, bip32Path: this.params.bip32Path }; + } if (this.params.network === MAINNET || this.params.keystore === TREZOR) return { xpub, rootFingerprint }; if (this.params.keystore === LEDGER || this.params.keystore === COLDCARD) diff --git a/src/tests/publicKeys.jsx b/src/tests/publicKeys.jsx index 827868cc..b4915193 100644 --- a/src/tests/publicKeys.jsx +++ b/src/tests/publicKeys.jsx @@ -1,6 +1,6 @@ import React from "react"; import { MAINNET, TESTNET, TEST_FIXTURES } from "unchained-bitcoin"; -import { COLDCARD, ExportPublicKey } from "unchained-wallets"; +import { COLDCARD, ExportPublicKey, HERMIT } from "unchained-wallets"; import Test from "./Test"; @@ -36,6 +36,9 @@ class ExportPublicKeyTest extends Test { const { pub, rootFingerprint } = TEST_FIXTURES.keys.open_source.nodes[ this.params.bip32Path ]; + if (this.params.keystore === HERMIT) { + return pub; + } return { publicKey: pub, rootFingerprint }; } } diff --git a/src/tests/signing.jsx b/src/tests/signing.jsx index 7f17c010..118b899a 100644 --- a/src/tests/signing.jsx +++ b/src/tests/signing.jsx @@ -7,7 +7,7 @@ import { unsignedTransactionObjectFromPSBT, TEST_FIXTURES, } from "unchained-bitcoin"; -import { SignMultisigTransaction } from "unchained-wallets"; +import { HERMIT, SignMultisigTransaction } from "unchained-wallets"; import { Box, Table, TableBody, TableRow, TableCell } from "@material-ui/core"; import { externalLink } from "../utils"; import Test from "./Test"; @@ -148,12 +148,29 @@ class SignMultisigTransactionTest extends Test { } export function signingTests(keystore) { - return TEST_FIXTURES.transactions.map((fixture) => { - return new SignMultisigTransactionTest({ - ...fixture, - ...{ keystore }, - }); - }); + const transactions = []; + + switch (keystore) { + case HERMIT: + TEST_FIXTURES.transactions.forEach((fixture) => { + if (!fixture.segwit) { + transactions.push( + new SignMultisigTransactionTest({ + ...fixture, + ...{ keystore }, + }) + ); + } + }); + return transactions; + default: + return TEST_FIXTURES.transactions.map((fixture) => { + return new SignMultisigTransactionTest({ + ...fixture, + ...{ keystore }, + }); + }); + } } export default signingTests;