1.1.0-multimodule.176 • Published 3 years ago

symbol-bootstrap-core v1.1.0-multimodule.176

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
3 years ago

symbol-bootstrap-core

Symbol Typescript/Javascript Library that allows you creating, configuring and running Symbol's simple node networks or nodes to be sync with existing networks.

Version Downloads/week License Build Status Coverage Status Api Doc

Usage

The library can be used by adding the dependency to your Typescript/Javascript project.

$ npm install --save symbol-bootstrap-core

Adding the dependency:

"dependencies": {
    ....
    "symbol-bootstrap-core": "1.1.x",
    ....
}

You can use the BootstrapService facade to programmatically configure, start and, stop a server.

If you are looking for the CLI tool, please got check out the cli README.

Node client E2E via API:

The lib can also be used as npm project (dev) dependency (npm install --save-dev symbol-bootstrap-core).

Then you can integrate the network to your npm test cycle.

Example:

import { BootstrapService, StartParams, Preset, Assembly } from 'symbol-bootstrap';
import { expect } from '@oclif/test'; 

it('Bootstrap e2e test', async () => {
    const service = new BootstrapService();
    const config: StartParams = {
        preset: Preset.dualCurrency,
        assembly: Assembly.multinode,
        reset: true,
        healthCheck: true,
        timeout: 60000 * 5,
        target: 'target/bootstrap-test',
        detached: true,
        user: 'current',
    };
    try {
        await service.stop(config);
        const configResult = await service.start(config);
        expect(configResult.presetData).not.null;
        expect(configResult.addresses).not.null;
        // Here you can write unit tests against a http://localhost:3000 network
    } finally {
        await service.stop(config);
    }
});

It's recommended to reuse the same server for multiple tests by using beforeAll, afterAll kind of statements.