]> git.codecow.com Git - libnemo.git/commitdiff
Update tests.
authorChris Duncan <chris@zoso.dev>
Mon, 21 Jul 2025 20:41:31 +0000 (13:41 -0700)
committerChris Duncan <chris@zoso.dev>
Mon, 21 Jul 2025 20:41:31 +0000 (13:41 -0700)
index.html
package.json
test/main.test.mjs [moved from test/test.main.mjs with 100% similarity]
test/perf.account.js

index c9627e61ae20bd90a9160c8e171d06ef14a89fd7..015377db8e79f9dc119a8904fd75d5ef1b141018 100644 (file)
@@ -91,7 +91,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        }
                })()
        </script>
-       <script type="module" src="./test/test.main.mjs"></script>
+       <script type="module" src="./test/main.test.mjs"></script>
        <style>body{background:black;color:white;}</style>
 </head>
 
index 67d0309e7b48551c841357ee99916b443ae91afd..e416ceaea0245f1bc8dfc3a655589a68499b1507 100644 (file)
@@ -48,7 +48,7 @@
                "build:prod": "npm run clean && node esbuild-prod.mjs",
                "publish": "npm run build:prod",
                "test": "npm run build",
-               "test:node": "npm run build:node && node --test --test-force-exit --env-file .env",
+               "test:node": "npm run build:node && node --test --test-force-exit --no-experimental-strip-types --env-file .env",
                "test:coverage": "npm run test:node -- --experimental-test-coverage",
                "test:coverage:report": "npm run test:coverage -- --test-reporter=lcov --test-reporter-destination=coverage.info && genhtml coverage.info --output-directory test/coverage && rm coverage.info && xdg-open test/coverage/index.html"
        },
similarity index 100%
rename from test/test.main.mjs
rename to test/main.test.mjs
index a0c5262d329e3e8bee6c74556aaf3d79205347c2..ea0671742313f9865e2a2a858c7b38241c5ab396 100644 (file)
@@ -14,53 +14,61 @@ await Promise.all([
                await test(`Time to create ${COUNT} BIP-44 accounts`, async () => {
                        const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD)
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
+
                        const start = performance.now()
                        const accounts = await wallet.accounts(0, COUNT - 1)
                        const end = performance.now()
                        console.log(`Total: ${end - start} ms`)
                        console.log(`Average: ${(end - start) / COUNT} ms`)
                        assert.equal(accounts.length, COUNT)
+
                        await wallet.destroy()
                })
 
                await test(`Time to create ${COUNT} BLAKE2b accounts`, async () => {
                        const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD)
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
+
                        const start = performance.now()
                        const accounts = await wallet.accounts(0, COUNT - 1)
                        const end = performance.now()
                        console.log(`Total: ${end - start} ms`)
                        console.log(`Average: ${(end - start) / COUNT} ms`)
                        assert.equal(accounts.length, COUNT)
+
                        await wallet.destroy()
                })
 
                await test(`Time to create 1 BIP-44 account ${COUNT} times`, async () => {
-                       const times = []
                        const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD)
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
+
+                       const times = []
                        for (let i = 0; i < COUNT; i++) {
                                const start = performance.now()
-                               await wallet.accounts(i)
+                               await wallet.account(i)
                                const end = performance.now()
                                times.push(end - start)
                        }
-                       await wallet.destroy()
                        console.log(stats(times))
+
+                       await wallet.destroy()
                })
 
-               await test(`Average time to create 1 BLAKE2b account ${COUNT} times`, async () => {
-                       const times = []
+               await test(`Time to create 1 BLAKE2b account ${COUNT} times`, async () => {
                        const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD)
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)
+
+                       const times = []
                        for (let i = 0; i < COUNT; i++) {
                                const start = performance.now()
-                               await wallet.accounts(i)
+                               await wallet.account(i)
                                const end = performance.now()
                                times.push(end - start)
                        }
-                       await wallet.destroy()
                        console.log(stats(times))
+
+                       await wallet.destroy()
                })
        })
 ])