TST: improved watch-only test

This commit is contained in:
overtorment 2024-03-20 16:44:22 +00:00
parent 41f68722ed
commit 3313bab16e

View File

@ -96,10 +96,18 @@ describe('Watch only wallet', () => {
assert.strictEqual(w.getBalance(), 200000);
await w.fetchTransactions();
assert.strictEqual(w.getTransactions().length, 4);
assert.ok((await w.getAddressAsync()).startsWith('bc1'));
const nextAddress = await w.getAddressAsync();
assert.strictEqual(w.getNextFreeAddressIndex(), 2);
assert.strictEqual(nextAddress, 'bc1q6442dedpwvqldldnsyux3cuz27paqks0pf2kvf');
assert.strictEqual(nextAddress, w._getExternalAddressByIndex(w.getNextFreeAddressIndex()));
const nextChangeAddress = await w.getChangeAddressAsync();
assert.strictEqual(nextChangeAddress, 'bc1qgltdyjnertcyvdn9hlkfpgr6hc260rjrss49uy');
});
// skipped because its generally rare case
// eslint-disable-next-line jest/no-disabled-tests
it.skip('can fetch txs for address funded by genesis txs', async () => {
const w = new WatchOnlyWallet();
w.setSecret('37jKPSmbEGwgfacCr2nayn1wTaqMAbA94Z');