From 3e511a4b2fbe1951b3d1ccfd13bfc5404fdda17e Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 20 Nov 2024 18:39:41 -0800 Subject: [PATCH] Use import aliases in test files. --- test/TEST_VECTORS.js | 4 ---- test/create-wallet.test.mjs | 6 +++--- test/derive-accounts.test.mjs | 6 +++--- test/import-wallet.test.mjs | 6 +++--- test/lock-unlock-wallet.mjs | 6 +++--- test/manage-rolodex.mjs | 6 +++--- test/refresh-accounts.test.mjs | 6 +++--- test/sign-blocks.test.mjs | 6 +++--- test/tools.test.mjs | 6 +++--- 9 files changed, 24 insertions(+), 28 deletions(-) diff --git a/test/TEST_VECTORS.js b/test/TEST_VECTORS.js index 6aa7a6a..1546572 100644 --- a/test/TEST_VECTORS.js +++ b/test/TEST_VECTORS.js @@ -33,10 +33,6 @@ export const NANO_TEST_VECTORS = Object.freeze({ ADDRESS_2: 'nano_3b5fnnerfrkt4me4wepqeqggwtfsxu8fai4n473iu6gxprfq4xd8pk9gh1dg' }) -/** -* Source: https://github.com/trezor/python-mnemonic/blob/master/vectors.json -* BLAKE2b keys calculated with Nano KeyTools: https://tools.nanos.cc/?tool=seed -*/ export const TREZOR_TEST_VECTORS = Object.freeze({ PASSWORD: 'TREZOR', diff --git a/test/create-wallet.test.mjs b/test/create-wallet.test.mjs index f07dbf2..d7511c9 100644 --- a/test/create-wallet.test.mjs +++ b/test/create-wallet.test.mjs @@ -3,11 +3,11 @@ 'use strict' -import './GLOBALS.mjs' +import '#test/GLOBALS.mjs' import { describe, it } from 'node:test' import { strict as assert } from 'assert' -import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' -import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '../dist/main.js' +import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js' +import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '#dist/main.js' describe('creating a new wallet', async () => { it('BIP-44 wallet with random entropy', async () => { diff --git a/test/derive-accounts.test.mjs b/test/derive-accounts.test.mjs index d5ea22e..6d44cca 100644 --- a/test/derive-accounts.test.mjs +++ b/test/derive-accounts.test.mjs @@ -3,11 +3,11 @@ 'use strict' -import './GLOBALS.mjs' +import '#test/GLOBALS.mjs' import { describe, it } from 'node:test' import { strict as assert } from 'assert' -import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' -import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '../dist/main.js' +import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js' +import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '#dist/main.js' describe('derive child accounts from the same seed', async () => { const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) diff --git a/test/import-wallet.test.mjs b/test/import-wallet.test.mjs index 1ac1954..c54ab6b 100644 --- a/test/import-wallet.test.mjs +++ b/test/import-wallet.test.mjs @@ -3,11 +3,11 @@ 'use strict' -import './GLOBALS.mjs' +import '#test/GLOBALS.mjs' import { describe, it } from 'node:test' import { strict as assert } from 'assert' -import { BIP32_TEST_VECTORS, CUSTOM_TEST_VECTORS, NANO_TEST_VECTORS, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js' -import { Account, Bip44Wallet, Blake2bWallet } from '../dist/main.js' +import { BIP32_TEST_VECTORS, CUSTOM_TEST_VECTORS, NANO_TEST_VECTORS, TREZOR_TEST_VECTORS } from '#test/TEST_VECTORS.js' +import { Account, Bip44Wallet, Blake2bWallet } from '#dist/main.js' describe('import wallet with test vectors test', () => { it('should successfully import a wallet with the official Nano test vectors mnemonic', async () => { diff --git a/test/lock-unlock-wallet.mjs b/test/lock-unlock-wallet.mjs index a8b3042..77a9e6d 100644 --- a/test/lock-unlock-wallet.mjs +++ b/test/lock-unlock-wallet.mjs @@ -3,11 +3,11 @@ 'use strict' -import './GLOBALS.mjs' +import '#test/GLOBALS.mjs' import { describe, it } from 'node:test' import { strict as assert } from 'assert' -import { NANO_TEST_VECTORS, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js' -import { Bip44Wallet, Blake2bWallet } from '../dist/main.js' +import { NANO_TEST_VECTORS, TREZOR_TEST_VECTORS } from '#test/TEST_VECTORS.js' +import { Bip44Wallet, Blake2bWallet } from '#dist/main.js' describe('locking and unlocking a Bip44Wallet', async () => { it('should succeed with a password', async () => { diff --git a/test/manage-rolodex.mjs b/test/manage-rolodex.mjs index 0d179d7..b80f506 100644 --- a/test/manage-rolodex.mjs +++ b/test/manage-rolodex.mjs @@ -3,11 +3,11 @@ 'use strict' -import './GLOBALS.mjs' +import '#test/GLOBALS.mjs' import { describe, it } from 'node:test' import { strict as assert } from 'assert' -import { Rolodex, Tools } from '../dist/main.js' -import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' +import { Rolodex, Tools } from '#dist/main.js' +import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js' describe('rolodex valid contact management', async () => { it('should create a rolodex and add two contacts', async () => { diff --git a/test/refresh-accounts.test.mjs b/test/refresh-accounts.test.mjs index 52636ac..cbb30d7 100644 --- a/test/refresh-accounts.test.mjs +++ b/test/refresh-accounts.test.mjs @@ -3,11 +3,11 @@ 'use strict' -import './GLOBALS.mjs' +import '#test/GLOBALS.mjs' import { describe, it } from 'node:test' import { strict as assert } from 'assert' -import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' -import { Account, Bip44Wallet, Rpc } from '../dist/main.js' +import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js' +import { Account, Bip44Wallet, Rpc } from '#dist/main.js' const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) diff --git a/test/sign-blocks.test.mjs b/test/sign-blocks.test.mjs index e1e676b..c539e00 100644 --- a/test/sign-blocks.test.mjs +++ b/test/sign-blocks.test.mjs @@ -3,11 +3,11 @@ 'use strict' -import './GLOBALS.mjs' +import '#test/GLOBALS.mjs' import { describe, it } from 'node:test' import { strict as assert } from 'assert' -import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' -import { SendBlock, ReceiveBlock, ChangeBlock } from '../dist/main.js' +import { NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js' +import { SendBlock, ReceiveBlock, ChangeBlock } from '#dist/main.js' describe('valid blocks', async () => { it('should not allow negative balances', async () => { diff --git a/test/tools.test.mjs b/test/tools.test.mjs index 4d98f9c..cbe4507 100644 --- a/test/tools.test.mjs +++ b/test/tools.test.mjs @@ -3,11 +3,11 @@ 'use strict' -import './GLOBALS.mjs' +import '#test/GLOBALS.mjs' import { describe, it } from 'node:test' import { strict as assert } from 'assert' -import { RAW_MAX, NANO_TEST_VECTORS } from './TEST_VECTORS.js' -import { Bip44Wallet, Account, SendBlock, Rpc, Tools } from '../dist/main.js' +import { RAW_MAX, NANO_TEST_VECTORS } from '#test/TEST_VECTORS.js' +import { Bip44Wallet, Account, SendBlock, Rpc, Tools } from '#dist/main.js' const skip = true -- 2.34.1