npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cinaconnect/testing

v0.2.0

Published

Testing utilities for CinaConnect — mock providers, wallets, chains, and transactions

Readme

@cinaconnect/testing

Testing utilities for CinaConnect — mock providers, wallets, chains, transactions, and fixtures.

Installation

npm install -D @cinaconnect/testing

Quick Start

import {
  MockProvider,
  MockWallet,
  MOCK_CHAINS,
  createMockTransaction,
  ADDRESSES,
} from "@cinaconnect/testing";

// Create a mock EIP-1193 provider
const provider = new MockProvider({
  accounts: ["0xabc..."],
  chainId: "0x1",
});

// Configure custom responses
provider.mock("eth_getBalance", { result: "0xde0b6b3a7640000" });
provider.mock("eth_sendTransaction", {
  error: { code: 4001, message: "User rejected" },
});

// Use with your wallet connector
const wallet = new MockWallet({
  accounts: ["0xabc..."],
  chainId: "0x1",
  connectDelay: 100,
});

await wallet.connect();
console.log(wallet.state); // { connected: true, accounts: [...], chainId: "0x1", ... }

API

MockProvider

Full EIP-1193 mock provider with configurable responses.

const provider = new MockProvider({
  accounts?: string[];          // default: 2 mock addresses
  chainId?: string;             // default: "0x1"
  defaultResponse?: object;     // fallback for unmocked methods
  responses?: Record<string, object>;  // per-method configs
  autoEmit?: boolean;           // default: true
});

// Configure responses
provider.mock("method_name", { result: value });
provider.mock("method_name", { error: { code, message, data? } });
provider.mock("method_name", { result: value, delay: 100 });

// State management
provider.setAccounts(["0xnew..."]);
provider.setChainId("0x89");
provider.reset();

// Call history
provider.callLog;       // array of { method, params, ts }
provider.resetCallLog();

// Events
provider.on("chainChanged", (chainId) => { ... });
provider.on("accountsChanged", (accounts) => { ... });
provider.once("connect", () => { ... });
provider.removeAllListeners();

// Builtin methods handled automatically:
//   eth_accounts, eth_chainId, eth_sendTransaction,
//   eth_signTypedData_v4, personal_sign,
//   wallet_switchEthereumChain, wallet_addEthereumChain,
//   wallet_requestPermissions, wallet_getPermissions, net_version

MockWallet

Simulated wallet connector.

const wallet = new MockWallet({
  connectorId?: string;   // default: "mock"
  accounts?: string[];
  chainId?: string;
  connectDelay?: number;
  disconnectDelay?: number;
  connectError?: Error | null;
  disconnectError?: Error | null;
});

await wallet.connect();      // returns WalletState
await wallet.disconnect();
await wallet.switchChain("0x89");
wallet.state;                // { connected, accounts, chainId, connectorId }
wallet.isConnected;
wallet.provider;             // underlying MockProvider

MockChains

Pre-built chain configurations.

import { MOCK_CHAINS, getChainById, createMockChain } from "@cinaconnect/testing";

MOCK_CHAINS.mainnet;         // Ethereum Mainnet config
MOCK_CHAINS.sepolia;         // Sepolia testnet
MOCK_CHAINS.polygon;
MOCK_CHAINS.optimism;
MOCK_CHAINS.arbitrum;
MOCK_CHAINS.base;
MOCK_CHAINS.localhost;
MOCK_CHAINS.hardhat;

getChainById(1);             // or "0x1"
getChainById("0x89");        // Polygon
createMockChain({ id: 999, name: "Custom" });

MockTransactions

Generate mock transactions and receipts.

import { createMockTransaction, createMockReceipt, simulateTransaction } from "@cinaconnect/testing";

const tx = createMockTransaction({
  from: "0x...",
  to: "0x...",
  value: "0x1000000000000000000",
});

const receipt = createMockReceipt(tx, "confirmed");  // or "failed" / "reverted"

// Simulate full lifecycle with delay
const { tx, receipt } = await simulateTransaction(
  { from: "0x...", to: "0x..." },
  "confirmed",
  500  // ms delay
);

Fixtures

Common test data.

import {
  ADDRESSES,       // pre-defined addresses (zero, user1, user2, contract, ens)
  SIGNATURES,      // valid, empty, malformed signatures
  HASHES,          // tx, block, data hashes
  TYPED_DATA,      // EIP-712 typed data example
  ERC20_ABI,       // ERC20 contract ABI
  ERC721_ABI,      // ERC721 contract ABI
  CHAIN_FIXTURES,  // chain shorthand objects
  PROVIDER_STATES, // disconnected, connected, multiAccount, testnet
  ERRORS,          // standard EIP-1193 error objects
} from "@cinaconnect/testing";

License

MIT