git.delta.rocks / unique-network / refs/commits / 8120aafe2828

difftreelog

source

tests/src/connection.test.ts798 Bsourcehistory
1import usingApi from "./substrate/substrate-api";2import { WsProvider } from '@polkadot/api';3import * as chai from 'chai';4import chaiAsPromised from 'chai-as-promised';56chai.use(chaiAsPromised);78const expect = chai.expect;910describe('Connection', () => {11  it('Connection can be established', async () => {12    await usingApi(async api => {13      const health = await api.rpc.system.health();14      expect(health).to.be.not.empty;15    });16  });1718  it('Cannot connect to 255.255.255.255', async () => {19    const neverConnectProvider = new WsProvider('ws://255.255.255.255:9944');20    await expect((async () => {21      await usingApi(async api => {22        const health = await api.rpc.system.health();23      }, { provider: neverConnectProvider });24    })()).to.be.eventually.rejected;25  });26});