🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@ton/test-utils

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ton/test-utils

Utilities for writing tests for smart contract systems in TON

latest
Source
npmnpm
Version
0.12.0
Version published
Weekly downloads
54K
7.76%
Maintainers
5
Weekly downloads
 
Created
Source

test-utils

This package contains useful testing utilities, such as unit test matchers (for jest, chai, and bun) and other useful functions, such as randomAddress.

Installation

yarn add @ton/test-utils -D

or

npm i --save-dev @ton/test-utils

Usage

To use the test matchers, just install either jest, chai, or bun and import this package like so:

import "@ton/test-utils";

Examples

Jest

import { expect } from '@jest/globals';
import "@ton/test-utils";

test('cell comparison', () => {
    expect(cell1).toEqualCell(cell2);
});

Chai

import { expect } from 'chai';
import "@ton/test-utils";

it('cell comparison', () => {
    expect(cell1).to.equalCell(cell2);
});

Bun

import { expect, test } from 'bun:test';
import "@ton/test-utils";

test('cell comparison', () => {
    expect(cell1).toEqualCell(cell2);
});

Transaction matcher notice

The transaction matcher (.toHaveTransaction) can only perform matching on transactions with descriptions of type generic. When matching an array of transactions, all transactions of other types will be filtered out. When matching a single transaction of non-generic type, an exception will be thrown.

License

This package is released under the MIT License.

FAQs

Package last updated on 22 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts