-
Notifications
You must be signed in to change notification settings - Fork 51
Integration Tests
Integration tests are for testing CodeChain application as a whole. Related files are located under test/
directory, and uses Typescript as script language.
yarn is used for package manager. To install dependencies, run following command:
yarn install
To run integration tests, run following command in integration test directory.
yarn start
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:
Assigns globally unique instance id to this object. Many parameters including secret key is derived from this instance id.
Spawns a new CodeChain node, and returns Promise that resolves when initialization is completed.
Kills a process and cleanup files created while running this node.