Skip to content

testing package#320

Open
Nitinyadav237 wants to merge 1 commit intogillsdk:masterfrom
Nitinyadav237:feat/gillsdk-testing
Open

testing package#320
Nitinyadav237 wants to merge 1 commit intogillsdk:masterfrom
Nitinyadav237:feat/gillsdk-testing

Conversation

@Nitinyadav237
Copy link

Problem

The project did not have a dedicated testing utilities package. Developers lacked a centralized place for fixtures, matchers, transaction log inspectors, and local validator setup when writing tests for Solana programs.

Summary of Changes

  • Created new package: packages/testing to house testing utilities.

  • Added Local Validator utilities

    • startLocalValidator({ airdropLamports?, programs?, resetLedger? }) → { rpc, ws, payer, close }
  • Added Fixtures

    • createFundedKeypair(rpc, lamports?)
    • createMint(rpc, { decimals?, mintAuthority?, freezeAuthority? })
    • ensureAta(rpc, { owner, mint })
    • mintTo(rpc, { mint, toOwner, amount, ensureAta? })
    • setupFungibleToken(rpc, payer, { owner, decimals?, amount })
  • Added Tx Log Inspector utilities

    • inspectTransaction(rpc, signature){ signature, slot, status, computeUnits?, logs[], accountsTouched[] }
    • Helpers: findCustomError(logs), totalComputeUnits(logs), listCpiCalls(logs)
  • Added Matchers

    • expectTxToSucceed(rpc, signature)
    • expectTxToFailWith(rpc, signature, { code|name|messageIncludes })
    • expectAccountToExist(rpc, address)
  • Organized source under src/ with subfolders

    • fixtures/, localValidator/, matchers/, txLogInspector/

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2025

⚠️ No Changeset found

Latest commit: f1407aa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nickfrosty
Copy link
Collaborator

where are these fixtures meant to be utilized? within the gill repo itself? or for consumers of the gill packages to write their own tests?

@Nitinyadav237
Copy link
Author

These fixtures are meant for consumers of the Gill packages — to help them write TypeScript tests for their own Solana programs and integrations.
For example, you can see them in action testing an Anchor escrow program here:
example link

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