Merge pull request #6297 from BlueWallet/tst-watchonly

TST: improved watch-only test
This commit is contained in:
GLaDOS 2024-03-20 18:56:32 +00:00 committed by GitHub
commit 9daf8921cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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');