Skip to content

Commit d7293e9

Browse files
committed
Fixes flaky e2e test.
- Fixes expectUserOperationToSucceed parameter type - Fixes expectUserOperationToSucceed to actually execute toBeTruthy assertion - Fixes call to expectUserOperationToSucceed in flaky test to pass UserOperationReceipt rather than UserOperationHash
1 parent 5c29bd2 commit d7293e9

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

packages/delegator-e2e/test/caveats/ownershipTransfer.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ describe('Ownership Transfer Caveat', () => {
148148
...gasPrice,
149149
});
150150

151-
await expectUserOperationToSucceed(userOpHash);
151+
const receipt = await sponsoredBundlerClient.waitForUserOperationReceipt({
152+
hash: userOpHash,
153+
});
154+
155+
await expectUserOperationToSucceed(receipt);
152156

153157
// Verify ownership was transferred successfully
154158
const finalOwner = await getContractOwner(contractAddress);

packages/delegator-e2e/test/utils/assertions.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Address } from 'viem';
22
import { expect } from 'vitest';
33
import { publicClient } from './helpers';
4-
import { UserOperationReceiptResponse } from '@metamask/delegation-toolkit';
5-
4+
import type { UserOperationReceipt } from 'viem/account-abstraction';
65
// common assertions to be shared across tests
76

87
export const expectCodeAt = async (address: Address, message?: string) => {
@@ -21,11 +20,11 @@ export const expectNoCodeAt = async (address: Address, message?: string) => {
2120
// todo: make this attempt to decode the failure logs
2221
// that is why I've made this asyncronous
2322
export const expectUserOperationToSucceed = async (
24-
receipt: UserOperationReceiptResponse,
23+
receipt: UserOperationReceipt,
2524
message?: string,
2625
) => {
2726
expect(
2827
receipt.success,
2928
message || `Expected user operation ${receipt.userOpHash} to succeed`,
30-
).toBeTruthy;
29+
).toBeTruthy();
3130
};

0 commit comments

Comments
 (0)