Skip to content

Commit 3ee97d6

Browse files
TaprootFreakclaude
andcommitted
fix: resolve linting errors and update EIP-5792 test expectations
- Remove unused variables (index, chainId parameters) - Replace non-null assertions with conditional spreading - Remove unused imports (act from @testing-library/react) - Prefix unused variables with underscore (_originalWindow) - Update EIP-5792 tests to expect version 2.0.0 format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dcb662a commit 3ee97d6

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/__tests__/api/sell-gasless-api.test.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ describe('Sell Gasless API Response', () => {
250250
expect(eip5792?.paymasterUrl).toBeDefined();
251251

252252
// Each call needs: to, data, value
253-
eip5792?.calls?.forEach((call, index) => {
253+
eip5792?.calls?.forEach((call) => {
254254
expect(call.to).toBeDefined();
255255
expect(call.data).toBeDefined();
256256
expect(call.value).toBeDefined();
@@ -286,10 +286,9 @@ describe('Gasless Response Variants', () => {
286286
it('should handle response with only EIP-7702 (no EIP-5792)', () => {
287287
const responseWithOnlyEip7702: SellPaymentInfoResponse = {
288288
...mockApiResponse,
289-
depositTx: {
290-
...mockApiResponse.depositTx!,
291-
eip5792: undefined,
292-
},
289+
depositTx: mockApiResponse.depositTx
290+
? { ...mockApiResponse.depositTx, eip5792: undefined }
291+
: undefined,
293292
};
294293

295294
const hasEip5792 = !!responseWithOnlyEip7702.depositTx?.eip5792;
@@ -305,10 +304,9 @@ describe('Gasless Response Variants', () => {
305304
...mockApiResponse,
306305
gaslessAvailable: false,
307306
eip7702Authorization: undefined,
308-
depositTx: {
309-
...mockApiResponse.depositTx!,
310-
eip5792: undefined,
311-
},
307+
depositTx: mockApiResponse.depositTx
308+
? { ...mockApiResponse.depositTx, eip5792: undefined }
309+
: undefined,
312310
};
313311

314312
const hasEip5792 = !!responseWithNoGasless.depositTx?.eip5792;
@@ -329,7 +327,7 @@ describe('Pimlico Paymaster URL', () => {
329327
{ name: 'polygon', chainId: 137 },
330328
];
331329

332-
chains.forEach(({ name, chainId }) => {
330+
chains.forEach(({ name }) => {
333331
it(`should have valid URL format for ${name}`, () => {
334332
const url = `https://api.pimlico.io/v2/${name}/rpc?apikey=test_key`;
335333

src/__tests__/change.hook.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { renderHook, act } from '@testing-library/react';
1+
import { renderHook } from '@testing-library/react';
22
import { useChange } from '../hooks/change.hook';
33

44
describe('useChange', () => {

src/__tests__/eip5792-real-hooks.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,12 @@ describe('EIP-5792 Real Hook Tests', () => {
280280
}
281281
if (method === 'wallet_sendCalls') {
282282
expect(params?.[0]).toMatchObject({
283-
version: '1.0',
283+
version: '2.0.0',
284284
chainId: '0x1',
285285
from: TEST_ACCOUNT,
286+
atomicRequired: false,
286287
capabilities: {
287-
paymasterService: { url: TEST_PAYMASTER_URL },
288+
paymasterService: { url: TEST_PAYMASTER_URL, optional: false },
288289
},
289290
});
290291
return { id: 'bundle-123' };
@@ -455,9 +456,10 @@ describe('EIP-5792 Real Hook Tests', () => {
455456
});
456457

457458
expect(capturedParams[0]).toEqual({
458-
version: '1.0',
459+
version: '2.0.0',
459460
chainId: '0x1',
460461
from: TEST_ACCOUNT,
462+
atomicRequired: false,
461463
calls: [
462464
{
463465
to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
@@ -466,7 +468,7 @@ describe('EIP-5792 Real Hook Tests', () => {
466468
},
467469
],
468470
capabilities: {
469-
paymasterService: { url: TEST_PAYMASTER_URL },
471+
paymasterService: { url: TEST_PAYMASTER_URL, optional: false },
470472
},
471473
});
472474
});

src/__tests__/iframe.hook.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { renderHook, act } from '@testing-library/react';
22
import { useIframe } from '../hooks/iframe.hook';
33

44
describe('useIframe', () => {
5-
const originalWindow = global.window;
5+
const _originalWindow = global.window;
66

77
beforeEach(() => {
88
// Reset window mock

src/__tests__/resize-observer.hook.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe('useResizeObserver', () => {
6868

6969
it('should disconnect observer on unmount', () => {
7070
const callback = jest.fn();
71-
const { result, unmount } = renderHook(() => useResizeObserver<HTMLDivElement>(callback));
71+
const { unmount } = renderHook(() => useResizeObserver<HTMLDivElement>(callback));
7272

7373
unmount();
7474

0 commit comments

Comments
 (0)