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
10 changes: 9 additions & 1 deletion .github/workflows/end-to-end-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ on:
NPM_CLIENT:
type: string
default: 'yarn'
RUN_FULL_TESTS:
type: boolean
default: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') }}
workflow_dispatch:
inputs:
RUN_FULL_TESTS:
type: boolean
default: true

jobs:
pipeline:
Expand Down Expand Up @@ -53,7 +61,7 @@ jobs:

- name: Run end-to-end tests
run: |
if [[ "$GITHUB_REF" == "refs/heads/main" ]] || [[ "$GITHUB_REF" =~ ^refs/heads/release/ ]]; then
if [[ "${{ inputs.RUN_FULL_TESTS }}" == "true" ]]; then
yarn e2etest:full
else
yarn e2etest:smoketest
Expand Down
16 changes: 11 additions & 5 deletions packages/delegator-e2e/test/caveats/nativeTokenPayment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ test('Bob attempts to redeem the delegation without providing a valid permission
),
});

const permissionsContext = '0x';
const permissionsContext = '0x' as const;

await runTest_expectFailure(
delegationRequiringNativeTokenPayment,
permissionsContext,
recipient,
'', // The NativeTokenPaymentEnforcer rejects when it fails to decode the permissions context
undefined, // The NativeTokenPaymentEnforcer rejects when it fails to decode the permissions context
);
});

Expand Down Expand Up @@ -295,15 +295,21 @@ const runTest_expectFailure = async (
delegation: Delegation,
permissionsContext: Hex,
recipient: Address,
expectedError: string,
expectedError: string | undefined,
) => {
const balanceBefore = await publicClient.getBalance({
address: recipient,
});

await expect(
const rejects = expect(
submitUserOpForTest(delegation, permissionsContext),
).rejects.toThrow(expectedError);
).rejects;

if (expectedError) {
await rejects.toThrow(expectedError);
} else {
await rejects.toThrow();
}

const balanceAfter = await publicClient.getBalance({
address: recipient,
Expand Down
Loading