Neolithic Psychedelic Mushrooms

    @windingtree/org.id-test-helpers
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.4 • Public • Published

    @windingtree/org.id-test-helpers

    @windingtree/org.id-test-helpers

    Javascript library for ORGiD smart contract testing

    Setup

    npm install @windingtree/org.id-test-helpers

    Usage

    import {
      ganache,
      HttpFileServer
    } from '@windingtree/org.id-test-helpers';
    
    const server = await ganache();
    
    server.getAccounts()
      .then(accounts => {
        console.log(accounts);
        /*
          [
            '0xe0367e4F58B1742B16DEE96E436554C4Ac679D23',
            '0x4cEAC03Ec8C9643b8be83830A45b69be430125d9',
            '0x19e17F4051f82471921C29319EE77c27992404b2',
            '0xdD004E3258CEfA1e01eC06dD6D88347Daf11eEA0',
            ...
          ]
        */
      })
      .catch(console.error);
    
    /*
    server.web3 // web3 instance
    server.port
    server.providerUri // web3 provider URI
    server.provider // web3 provider
    server.close() // async closing the server
    */
    
    // HttpFileServer can be used for testing cases where it is required to host files
    const httpServer = new HttpFileServer();
    httpServer.start()
      .then(() => {
        const file = {
          type: 'json',
          path: '<path_with_name>.json',
          content: '{"test": "test"}'
        };
        httpServer.addFile(file);
    
        const { data } = await axios.get(`${httpServer.baseUri}/${file.path}`);
        console.log(data);
        // {"test": "test"}
    
      })
      .catch(console.error);

    Documentation

    Generated docs

    Install

    npm i @windingtree/org.id-test-helpers

    DownloadsWeekly Downloads

    10

    Version

    0.2.4

    License

    MIT

    Unpacked Size

    25.2 kB

    Total Files

    15

    Last publish

    Collaborators

    • valera_rozuvan
    • kostysh
    • kvakes
    • tomashq