]> git.codecow.com Git - libnemo.git/commitdiff
Assert account address before testing refresh.
authorChris Duncan <chris@codecow.com>
Tue, 4 Aug 2026 14:46:22 +0000 (07:46 -0700)
committerChris Duncan <chris@codecow.com>
Tue, 4 Aug 2026 14:46:22 +0000 (07:46 -0700)
test/test.refresh-accounts.mjs

index 9757028b3c4b0bb7f2f73b5aa000d9a5f3513ba3..387ea1573e55cc7500c7441dbf36f5570d0df4d7 100644 (file)
@@ -3,7 +3,7 @@
 
 'use strict'
 
-import { Account, Wallet, Rpc } from 'libnemo'
+import { Account, Rpc, Wallet } from 'libnemo'
 import { assert, env, suite, test } from './GLOBALS.mjs'
 import { NANO_TEST_VECTORS, TEST_PASSWORD } from './VECTORS.mjs'
 
@@ -11,11 +11,11 @@ const rpc = new Rpc(env.NODE_URL ?? '', env.API_KEY_NAME)
 
 await Promise.all([
        suite('Refreshing account info', { skip: false }, async () => {
-
                await test('fetch balance, frontier, and representative', async () => {
                        const wallet = await Wallet.load('BIP-44', TEST_PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)
                        await wallet.unlock(TEST_PASSWORD)
                        const account = await wallet.account()
+                       assert.equal(NANO_TEST_VECTORS.ADDRESS_0, account.address)
                        await account.refresh(rpc)
 
                        assert.exists(account.balance)
@@ -26,7 +26,7 @@ await Promise.all([
                        assert.exists(account.frontier)
                        assert.equal(typeof account.frontier, 'string')
                        assert.notEqual(account.frontier, '')
-                       assert.ok(/^[A-F0-9]{64}$/i.test(account.frontier ?? ''))
+                       assert.ok(/^[0-9A-F]{64}$/i.test(account.frontier ?? ''))
 
                        assert.exists(account.representative)
                        assert.notEqual(account.representative, '')