Skip to content

Commit

Permalink
Fix Zemu tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apaillier-ledger committed Feb 1, 2023
1 parent 8a32c31 commit 653ae58
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/src/test.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const NANOS_ETH_PATH = Resolve("elfs/ethereum_nanos.elf");
const NANOSP_ETH_PATH = Resolve("elfs/ethereum_nanosp.elf");
const NANOX_ETH_PATH = Resolve("elfs/ethereum_nanox.elf");

const NANOS_PLUGIN_PATH = Resolve("elfs/ledger_nft_nanos.elf");
const NANOSP_PLUGIN_PATH = Resolve("elfs/ledger_nft_nanosp.elf");
const NANOX_PLUGIN_PATH = Resolve("elfs/ledger_nft_nanox.elf");
const NANOS_PLUGIN_PATH = Resolve("elfs/plugin_nanos.elf");
const NANOSP_PLUGIN_PATH = Resolve("elfs/plugin_nanosp.elf");
const NANOX_PLUGIN_PATH = Resolve("elfs/plugin_nanox.elf");

const NANOS_PLUGIN = { LedgerNFT: NANOS_PLUGIN_PATH };
const NANOSP_PLUGIN = { LedgerNFT: NANOSP_PLUGIN_PATH };
Expand Down Expand Up @@ -82,7 +82,7 @@ function txFromEtherscan(rawTx) {
* Emulation of the device using zemu
* @param {string} device name of the device to emulate (nanos, nanox)
* @param {function} func
* @param {boolean} signed the plugin is already signed
* @param {boolean} signed the plugin is already signed
* @returns {Promise}
*/
function zemu(device, func, testNetwork, signed = false) {
Expand All @@ -91,7 +91,7 @@ function zemu(device, func, testNetwork, signed = false) {
let eth_path;
let plugin;
let sim_options = sim_options_generic;

if (device === "nanos") {
eth_path = NANOS_ETH_PATH;
plugin = NANOS_PLUGIN;
Expand All @@ -105,14 +105,14 @@ function zemu(device, func, testNetwork, signed = false) {
plugin = NANOX_PLUGIN;
sim_options.model = "nanox";
}

const sim = new Zemu(eth_path, plugin);

try {
await sim.start(sim_options);
const transport = await sim.getTransport();
const eth = new Eth(transport);

if (!signed) {
config = generate_plugin_config(testNetwork);
eth.setLoadConfig({
Expand Down Expand Up @@ -215,4 +215,4 @@ module.exports = {
populateTransaction,
zemu,
genericTx
};
};

0 comments on commit 653ae58

Please sign in to comment.