@ton/test-utils
TypeScript icon, indicating that this package has built-in type declarations

0.10.0 • Public • Published

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.

/@ton/test-utils/

    Package Sidebar

    Install

    npm i @ton/test-utils

    Weekly Downloads

    7,347

    Version

    0.10.0

    License

    MIT

    Unpacked Size

    41.1 kB

    Total Files

    31

    Last publish

    Collaborators

    • ikardanov
    • mrmld
    • talkol
    • tsivarev
    • it-tonstudio-io