To get started with unit tests you need to startup the sandboxed bitcoin regtest network described in docker-compose.yml. This will creates a network of bitcoin nodes with one of the nodes connected to SLPDB.
Start the test network:
$ cd regtest
$ docker-compose up -d
$ docker logs -f regtest_slpdb_1
Run the unit tests:
$ npm test
Take a look at the tests in the test directory for guidance on how to create unit tests.
- Uncomment mongo entrypoint/volume lines in
docker-compose.yml - Delete
regtest/mongo/dbandregtest/mongo/configdbdirectories - Run
docker-compose up -d - Run
docker exec -it regtest_mongo_1 mongo - Run
rs.initiate() - Run
rs.status()to make sureok: 1 - Run
cfg = rs.config() - Run
cfg.members[0].host = "localhost:27017" - Run
cfg.reconfig(cfg, {force:true})