diff --git a/web3.js/test/connection.test.ts b/web3.js/test/connection.test.ts index 609d2a0c25..742cc02d15 100644 --- a/web3.js/test/connection.test.ts +++ b/web3.js/test/connection.test.ts @@ -32,6 +32,7 @@ import { EpochInfo, InflationGovernor, Logs, + SignatureResult, SlotInfo, } from '../src/connection'; import {sleep} from '../src/util/sleep'; @@ -3685,6 +3686,20 @@ describe('Connection', function () { } }); + it('signature notification', async () => { + const owner = Keypair.generate(); + const signature = await connection.requestAirdrop( + owner.publicKey, + LAMPORTS_PER_SOL, + ); + const signatureResult = await new Promise(resolve => { + // NOTE: Signature subscriptions auto-remove themselves, so there's no + // need to track the subscription id and remove it when the test ends. + connection.onSignature(signature, resolve, 'processed'); + }); + expect(signatureResult.err).to.be.null; + }); + it('logs notification', async () => { let subscriptionId: number | undefined; const owner = Keypair.generate();