Skip to content

Commit

Permalink
Fixes and better errors for tests (#2100)
Browse files Browse the repository at this point in the history
Seeing new flakyness in the sdk tests. Seems like the build machine is
either faster or slower.
The timeline test fails locally for me, forcing some miniblocks makes
scrollback more preditable
The space is failing to mint in some instances, i feel like this will
give us a better error message
  • Loading branch information
texuf authored Jan 21, 2025
1 parent 0fa1990 commit db2a304
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/sdk/src/tests/multi/sync-agent/timeline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,25 @@ describe('timeline.test.ts', () => {

for (let i = 0; i < NUM_MESSAGES; i++) {
await bobChannel.sendMessage(`message ${i}`)
// force miniblocks, if we're going fast it's possible that the miniblock is not created
if ((i % NUM_MESSAGES) / 4 == 0) {
await bob.riverConnection.client?.debugForceMakeMiniblock(bobChannel.data.id)
}
}
// alice joins the room
await alice.spaces.getSpace(spaceId).join(aliceUser.signer)
const aliceChannel = alice.spaces.getSpace(spaceId).getDefaultChannel()
// alice shouldnt receive all the messages, only a few
await waitFor(() =>
expect(aliceChannel.timeline.events.value.length).toBeLessThan(NUM_MESSAGES / 2),
expect(aliceChannel.timeline.events.value.length).toBeLessThan(NUM_MESSAGES),
)
const aliceChannelLength = aliceChannel.timeline.events.value.length
// call scrollback
await aliceChannel.timeline.scrollback()
// did we get more events?
await waitFor(() =>
expect(aliceChannel.timeline.events.value.length).toBeGreaterThanOrEqual(
NUM_MESSAGES / 2,
aliceChannelLength,
),
)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/web3/src/v3/SpaceDapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,7 @@ async function wrapTransaction(
(error as { code: unknown }).code === 'CALL_EXCEPTION'
) {
logger.error('Transaction failed', { tx, errorCount, error })
throw new Error('Transaction confirmed but failed')
throw error
}

// If the transaction receipt is not available yet, the error may be thrown
Expand Down

0 comments on commit db2a304

Please sign in to comment.