@sign-global/tokentable-core
v1.14.0
Published
Core utilities and functions for the TokenTable SDK.
Downloads
93
Readme
TokenTable Core Package
Core utilities and functions for the TokenTable SDK.
Development
Testing
This package uses Vitest for testing.
Running Tests
# Run tests once
pnpm test:run
# Run tests in watch mode
pnpm test
# Run tests with UI
pnpm vitest --uiTest Structure
Tests are located in src/**/__tests__/ directories following the pattern *.test.ts.
Current Test Coverage
getOrCreateAssociatedTokenAccount- Comprehensive tests for Solana associated token account creation- Tests existing account retrieval
- Tests new account creation when account doesn't exist
- Tests error handling for invalid mint/owner
- Tests custom parameter handling
- Tests unexpected error propagation
Building
# Build the package
pnpm build
# Build in watch mode
pnpm build:watchCleaning
# Clean build artifacts
pnpm cleanTesting Philosophy
The tests use comprehensive mocking to isolate the unit under test while ensuring all code paths are covered. Key testing principles:
- Isolation: External dependencies are mocked to focus on the function logic
- Coverage: All branches and error conditions are tested
- Realistic Data: Valid Solana public keys and realistic mock data are used
- Error Handling: Both expected and unexpected errors are tested
Dependencies
This package depends on:
@solana/web3.js- Solana blockchain interaction@solana/spl-token- SPL Token program utilities- Various other blockchain and utility libraries
Dev dependencies include:
vitest- Testing frameworkjsdom- DOM environment for tests
