Skip to content

Instantly share code, notes, and snippets.

@mefrem
Created November 30, 2022 21:35
Show Gist options
  • Save mefrem/2bf45cca830e7247ec67af4a4d3bd4ea to your computer and use it in GitHub Desktop.
Save mefrem/2bf45cca830e7247ec67af4a4d3bd4ea to your computer and use it in GitHub Desktop.
title
Unit test reference manual

Clarinet supports automatic testing, where your blockchain application requirements can be converted to test cases. Clarinet's testing harness is run on Deno: Define your unit tests and then register them with an API call to Clarinet.test inside your test files.

Clarinet's Deno module comes with a number of predefined objects that simulate the Stacks and Bitcoin production environments your smart contracts operate in. This page is a reference manual for those Deno objects so that you can write robust unit tests for your Clarity smart contracts.

For a complete list of classes, objects, and interfaces available, see the Deno's Clarinet module index.

Class reference

Chain

Chain(sessionId: number)

Properties

blockHeight: number

sessionId: number

Methods

callReadOnlyFn(contract: string, method: string, args: Array<any>,sender: string): ReadOnlyFn

getAssetsMaps(): AssetsMaps

mineBlock(transactions: Array<Tx>): Block

mineEmptyBlock(count: number): EmptyBlock

mineEmptyBlockUntil(targetBlockHeight: number): EmptyBlock

Clarinet

Tx

Interface reference

Account

AssetsMaps

Block

Chain

Contract

EmptyBlock

ReadOnlyFn

StacksNode

TxContractCall

TxDeployContract

TxReceipt

TxTransfer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment