Halva Test Example
Halva is a toolchain for improving the experience of developing Decentralized Applications based on Substrate.
📝 Table of Contents
🧐 About
Halva is a toolchain for developing Decentralized Applications based on Substrate. It provides a high-level way to configure a development environment, interact with Substrate through external API and writing your test cases. Halva targets testing extrinsics via RPC calls this allows test Substrate (or clients compatible with Substrate RPC) as a black-box.
🏁 Getting Started
Installing
Before running the tests, you need to:
Clone this repo
git clone https://github.com/halva-suite/halva-test-example.git
cd halva-test-example/
Install halva-cli
npm install halva-cli -g
If necessary, you can install spec-builder
npm install spec-builder -g
🔧 Running the tests
All tests are in the test
folder
Run node:
halva-cli start
Use cli to start tests:
halva-cli test
If you need help, use
halva-cli --help
Writing test notes
You can use global variables provided by halva
describe('Halva test', () => {
describe('test global', () => {
it('Transfer balance to bob(passes)', async () => {
const tx = halva.polkadot.tx.balances.transfer(bobPair.address, '10000000');
await passes(tx, 'Send', alicePair);
});
});
});
Variables
- halva.accounts - 10 Key pairs for tests
- halva.polkadot - ApiPromise object of polkadot
⛏️ Built Using
- Mocha - Test framework
- PolkadotJs - Api for substrate
- NodeJs - Server Environment