From: Chris Duncan Date: Thu, 5 Dec 2024 18:34:00 +0000 (-0800) Subject: Convert from node to jest test execution. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=92ff6372bf5585c4ac3f9d7d75f8031c06c8e993;p=libnemo.git Convert from node to jest test execution. --- diff --git a/test/create-wallet.test.mjs b/test/create-wallet.test.mjs index 4089db5..80ff375 100644 --- a/test/create-wallet.test.mjs +++ b/test/create-wallet.test.mjs @@ -13,24 +13,24 @@ describe('creating a new wallet', async () => { const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - assert.ok('id' in wallet) - assert.ok(/[A-Fa-f0-9]{32,64}/.test(wallet.id)) - assert.ok('mnemonic' in wallet) - assert.ok(/^(?:[a-z]{3,} ){11,23}[a-z]{3,}$/.test(wallet.mnemonic)) - assert.ok('seed' in wallet) - assert.ok(/[A-Fa-f0-9]{32,64}/.test(wallet.seed)) + expect('id' in wallet).toBeTruthy() + expect(/[A-Fa-f0-9]{32,64}/.test(wallet.id)).toBeTruthy() + expect('mnemonic' in wallet).toBeTruthy() + expect(/^(?:[a-z]{3,} ){11,23}[a-z]{3,}$/.test(wallet.mnemonic)).toBeTruthy() + expect('seed' in wallet).toBeTruthy() + expect(/[A-Fa-f0-9]{32,64}/.test(wallet.seed)).toBeTruthy() }) test('BLAKE2b wallet with random entropy', async () => { const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - assert.ok('id' in wallet) - assert.ok(/[A-Fa-f0-9]{32,64}/.test(wallet.id)) - assert.ok('mnemonic' in wallet) - assert.ok(/^(?:[a-z]{3,} ){11,23}[a-z]{3,}$/.test(wallet.mnemonic)) - assert.ok('seed' in wallet) - assert.ok(/[A-Fa-f0-9]{32,64}/.test(wallet.seed)) + expect('id' in wallet).toBeTruthy() + expect(/[A-Fa-f0-9]{32,64}/.test(wallet.id)).toBeTruthy() + expect('mnemonic' in wallet).toBeTruthy() + expect(/^(?:[a-z]{3,} ){11,23}[a-z]{3,}$/.test(wallet.mnemonic)).toBeTruthy() + expect('seed' in wallet).toBeTruthy() + expect(/[A-Fa-f0-9]{32,64}/.test(wallet.seed)).toBeTruthy() }) test('BIP-44 replace invalid salt with empty string', async () => { @@ -43,22 +43,22 @@ describe('creating a new wallet', async () => { test('fail when using new', async () => { //@ts-expect-error - assert.throws(() => new Bip44Wallet()) + expect(() => new Bip44Wallet()).toThrow() //@ts-expect-error - assert.throws(() => new Blake2bWallet()) + expect(() => new Blake2bWallet()).toThrow() //@ts-expect-error - assert.throws(() => new LedgerWallet()) + expect(() => new LedgerWallet()).toThrow() }) test('fail without a password', async () => { //@ts-expect-error - await assert.rejects(Bip44Wallet.create()) + expect(async () => await Bip44Wallet.create()).rejects() //@ts-expect-error - await assert.rejects(Blake2bWallet.create()) + expect(async () => await Blake2bWallet.create()).rejects() }) test.skip('connect to ledger', async () => { const wallet = await LedgerWallet.create() - assert.ok(wallet) + expect(wallet).toBeDefined() }) })