diff --git a/web3.js/test/connection.test.js b/web3.js/test/connection.test.js index 7fe5f2472cef2e..b4abea830dc908 100644 --- a/web3.js/test/connection.test.js +++ b/web3.js/test/connection.test.js @@ -480,6 +480,11 @@ test('transaction', async () => { result: 31, }, ]); + if (!mockRpcEnabled) { + // Credit-only account credits are committed at the end of every slot; + // this sleep is to ensure a full slot has elapsed + await sleep((1000 * DEFAULT_TICKS_PER_SLOT) / NUM_TICKS_PER_SECOND); + } expect(await connection.getBalance(accountTo.publicKey)).toBe(31); });