Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
fix(wallet): hermit test suite updates
Browse files Browse the repository at this point in the history
  • Loading branch information
humanumbrella authored and waldenraines committed Dec 17, 2020
1 parent 19e69a5 commit 5d97ed3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/tests/extendedPublicKeys.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
TREZOR,
COLDCARD,
ExportExtendedPublicKey,
HERMIT,
} from "unchained-wallets";
import Test from "./Test";

Expand Down Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion src/tests/publicKeys.jsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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 };
}
}
Expand Down
31 changes: 24 additions & 7 deletions src/tests/signing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;

0 comments on commit 5d97ed3

Please sign in to comment.