Skip to content

Conversation

@rishavmehra
Copy link
Contributor

@rishavmehra rishavmehra commented Nov 18, 2025

Description

Issue #379

Screenshots / Video

Checklist

  • Tests have been added for my change
  • Docs have been updated for my change

Important

Add unit tests for getAccountInfo to cover expected and unexpected behaviors, including error handling.

  • Tests Added:
    • Unit tests for getAccountInfo in get-account-info.test.ts.
    • Tests for correct RPC call with valid address.
    • Tests for handling accounts with no data and executable programs.
    • Tests for error handling when RPC call fails and invalid address format.

This description was created by Ellipsis for 441fb6a. You can customize this summary. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Changes requested ❌

Reviewed everything up to 441fb6a in 2 minutes and 37 seconds. Click for details.
  • Reviewed 141 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/solana-client/test/get-account-info.test.ts:12
  • Draft comment:
    Consider using lowerCamelCase (e.g. accountInfo) for plain objects instead of PascalCase (AccountInfo), which is typically reserved for classes or constructors.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_TUCarj6A2Cfkm1eU

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

} as unknown as SolanaClient

// ACT & ASSERT
expect(() =>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if getAccountInfo throws synchronously for invalid addresses. In other tests, it returns a promise (using await). If getAccountInfo is always async, consider using await expect(...).rejects.toThrow() for consistency.

Comment on lines +44 to +50
const mockSend = vi.fn().mockResolvedValue(AccountInfo)
const mockGetAccountInfo = vi.fn().mockReturnValue({ send: mockSend })
const mockClient = {
rpc: {
getAccountInfo: mockGetAccountInfo,
},
} as unknown as SolanaClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mock only what's needed but create the actual client https://vitest.dev/guide/mocking.html

const result = await getAccountInfo(mockClient, { address: testAddress })

// ASSERT
expect(result).toEqual(AccountInfo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not very useful because you are just testing the mock. What else can we assert here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants