Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/delegator-e2e/test/caveats/ownershipTransfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ describe('Ownership Transfer Caveat', () => {
...gasPrice,
});

await expectUserOperationToSucceed(userOpHash);
const receipt = await sponsoredBundlerClient.waitForUserOperationReceipt({
hash: userOpHash,
});

await expectUserOperationToSucceed(receipt);

// Verify ownership was transferred successfully
const finalOwner = await getContractOwner(contractAddress);
Expand Down Expand Up @@ -304,7 +308,11 @@ describe('Ownership Transfer Caveat', () => {
...gasPrice,
});

await expectUserOperationToSucceed(userOpHash);
const receipt = await sponsoredBundlerClient.waitForUserOperationReceipt({
hash: userOpHash,
});

await expectUserOperationToSucceed(receipt);

// Verify ownership was transferred successfully
const finalOwner = await getContractOwner(contractAddress);
Expand Down
7 changes: 3 additions & 4 deletions packages/delegator-e2e/test/utils/assertions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Address } from 'viem';
import { expect } from 'vitest';
import { publicClient } from './helpers';
import { UserOperationReceiptResponse } from '@metamask/delegation-toolkit';

import type { UserOperationReceipt } from 'viem/account-abstraction';
// common assertions to be shared across tests

export const expectCodeAt = async (address: Address, message?: string) => {
Expand All @@ -21,11 +20,11 @@ export const expectNoCodeAt = async (address: Address, message?: string) => {
// todo: make this attempt to decode the failure logs
// that is why I've made this asyncronous
export const expectUserOperationToSucceed = async (
receipt: UserOperationReceiptResponse,
receipt: UserOperationReceipt,
message?: string,
) => {
expect(
receipt.success,
message || `Expected user operation ${receipt.userOpHash} to succeed`,
).toBeTruthy;
).toBeTruthy();
};
Loading