Skip to content

Commit

Permalink
Hopefully fix flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zencephalon committed Feb 15, 2024
1 parent 7374a11 commit 87fbf7a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
6 changes: 4 additions & 2 deletions src/hooks/L1/useWriteDepositERC20.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ test('useWriteDepositERC20', async () => {
})

await waitFor(() => {
expect(result.current.error).toBeNull()
expect(result.current.isSuccess).toBeTruthy()
Promise.all([
expect(result.current.error).toBeNull(),
expect(result.current.isSuccess).toBeTruthy(),
])
})

expect(result.current).toMatchInlineSnapshot(`
Expand Down
7 changes: 4 additions & 3 deletions src/hooks/L1/useWriteDepositETH.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ test('useWriteDepositETH', async () => {

// since we didn't use the async wait for it to succeed
await waitFor(() => {
// check for error first so if one happens we can see it in the test failure
expect(result.current.error).toBeNull()
expect(result.current.isSuccess).toBeTruthy()
Promise.all([
expect(result.current.error).toBeNull(),
expect(result.current.isSuccess).toBeTruthy(),
])
})

// now assert the result is what we expect
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/L1/useWriteFinalizeWithdrawalTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ test('useWriteFinalizeWithdrawalTransaction', async () => {
})

await waitFor(() => {
expect(result.current.error).toBeNull()
expect(result.current.isSuccess).toBeTruthy()
Promise.all([
expect(result.current.error).toBeNull(),
expect(result.current.isSuccess).toBeTruthy(),
])
})

expect(result.current).toMatchInlineSnapshot(`
Expand Down
10 changes: 6 additions & 4 deletions src/hooks/L1/useWriteProveWithdrawalTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ test('useWriteProveWithdrawalTransaction', async () => {
})

await waitFor(() => {
expect(result.current.error).toBeNull()
// We're only checking that we're able to successfully call the contract. The snapshot
// will continue to change as blocks get procuded, and this check is sufficient.
expect(result.current.isSuccess).toBeTruthy()
Promise.all([
expect(result.current.error).toBeNull(),
// We're only checking that we're able to successfully call the contract. The snapshot
// will continue to change as blocks get procuded, and this check is sufficient.
expect(result.current.isSuccess).toBeTruthy(),
])
})
}, { retry: 3 })
6 changes: 4 additions & 2 deletions src/hooks/L2/useWriteWithdrawERC20.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ test('useWriteWithdrawERC20', async () => {
})

await waitFor(() => {
expect(result.current.useWriteWithdrawERC20.error).toBeNull()
expect(result.current.useWriteWithdrawERC20.isSuccess).toBeTruthy()
Promise.all([
expect(result.current.useWriteWithdrawERC20.error).toBeNull(),
expect(result.current.useWriteWithdrawERC20.isSuccess).toBeTruthy(),
])
})

expect(result.current.useWriteWithdrawERC20).toMatchInlineSnapshot(`
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/L2/useWriteWithdrawETH.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ test('useWriteWithdrawETH', async () => {
})

await waitFor(() => {
expect(result.current.useWriteWithdrawETH.error).toBeNull()
expect(result.current.useWriteWithdrawETH.isSuccess).toBeTruthy()
Promise.all([
expect(result.current.useWriteWithdrawETH.error).toBeNull(),
expect(result.current.useWriteWithdrawETH.isSuccess).toBeTruthy(),
])
})

expect(result.current.useWriteWithdrawETH).toMatchInlineSnapshot(`
Expand Down

0 comments on commit 87fbf7a

Please sign in to comment.