Skip to content

Integration Tests

Joon-Mo Yang edited this page Jun 22, 2018 · 7 revisions

Integration tests are for testing CodeChain application as a whole. Related files are located under test/ directory, and uses Typescript as script language.

Installing Dependencies

yarn is used for package manager. To install dependencies, run following command:

yarn install

Running Tests

To run integration tests, run following command in integration test directory.

yarn start

Writing Test

Simple integration test that sends several parcels and gets invoice from CodeChain is implemented at src/basic.test.ts. It would be a good starting point for implementing new tests.

Writing a integration test involves spawning a new CodeChain process and attaching SDK to it. Helper class for automating this process is defined under src/helper/spawn.ts, named CodeChain. Some important functions are described below:

constructor

Assigns globally unique instance id to this object. Many parameters including secret key is derived from this instance id.

start

Spawns a new CodeChain node, and returns Promise that resolves when initialization is completed.

clean

Kills a process and cleanup files created while running this node.

Clone this wiki locally