chaithereum v2.0.8
chaithereum
Unit testing 'utility belt' for Ethereum Solidity contracts
npm install chaithereum
Usage
const Chaithereum = require('chaithereum')
const chaithereum = new Chaithereum(/*options*/)Examples
One good place to look for chaithereum examples is the safemarket/protocol repo. Those tests were written with chaithereum@1.0, however their API is the same. The only difference is that in chaithereum@2.0, require('chaithereum') returns a Chaithereum constructor instead of a chaithereum instance.
Options
options.Web3
A Web3 constructor. Default listed in package.json.
options.chai
A chai instance. Default listed in package.json.
options.provider
A Web3 provider instance. Default is provider generated by testrpc listed in package.json
Interface
chaithereum.chai
A custom chai instance
chaithereum.web3
A custom web3 instance suited for unit testing
chaithereum.provider
The provider used to instantiate web3
chaithereum.promise
A Q promise that will be fulfilled when chaithereum is ready. Typically you would start a test waiting for the chaitheruem promise.
before(() => { return chaithereum.promise })chaithereum.accounts
A list of 10 accounts
chaithereum.account
The first account, set as web3.eth.defaultAccount
chaithereum.generateAddress() returns promise of an address
Generate an address asynchronously. chaithereum.generateAddress().then((address) => { ... }))
chaithereum.generateAddresses(count) returns promise of addresses
Generate an addresses asynchronously. chaithereum.generateAddresses(5).then((addresses[5]) => { ... }))
chaithereum.increaseTime(seconds) returns promise
Jump forward in time asynchronously. chaithereum.increaseTime(42).then(() => { ... }))
chaithereum.mineBlock() returns promise
Mine a block. chaithereum.mineBlock().then(() => { ... }))
chaithereum.mineBlocks(count) returns promise
Mine count blocks. chaithereum.mineBlocks(...).then(() => { ... }))
chaithereum.takeSnapshot() returns promise
Take a snapshot of the current state. chaithereum.takeSnapshot(...).then((id) => { ... }))
chaithereum.revertSnapshot(id) returns promise
Take a snapshot of the current state. chaithereum.revertSnapshot(...).then(() => { ... }))
Bindings
Chaithereum loads bindings from the following packages
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago