Skip to content

Commit f3a5937

Browse files
committed
Don't expect any specific error when providing an invalid permission context (rather than empty string which fails to match)
1 parent f71db8f commit f3a5937

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ test('Bob attempts to redeem the delegation without providing a valid permission
177177
),
178178
});
179179

180-
const permissionsContext = '0x';
180+
const permissionsContext = '0x' as const;
181181

182182
await runTest_expectFailure(
183183
delegationRequiringNativeTokenPayment,
184184
permissionsContext,
185185
recipient,
186-
'', // The NativeTokenPaymentEnforcer rejects when it fails to decode the permissions context
186+
undefined, // The NativeTokenPaymentEnforcer rejects when it fails to decode the permissions context
187187
);
188188
});
189189

@@ -295,15 +295,21 @@ const runTest_expectFailure = async (
295295
delegation: Delegation,
296296
permissionsContext: Hex,
297297
recipient: Address,
298-
expectedError: string,
298+
expectedError: string | undefined,
299299
) => {
300300
const balanceBefore = await publicClient.getBalance({
301301
address: recipient,
302302
});
303303

304-
await expect(
304+
const rejects = expect(
305305
submitUserOpForTest(delegation, permissionsContext),
306-
).rejects.toThrow(expectedError);
306+
).rejects;
307+
308+
if (expectedError) {
309+
await rejects.toThrow(expectedError);
310+
} else {
311+
await rejects.toThrow();
312+
}
307313

308314
const balanceAfter = await publicClient.getBalance({
309315
address: recipient,

0 commit comments

Comments
 (0)