git.delta.rocks / unique-network / refs/commits / 0734ff6eabec

difftreelog

source

tests/src/connection.test.ts923 Bsourcehistory
1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import usingApi from './substrate/substrate-api';7import {WsProvider} from '@polkadot/api';8import * as chai from 'chai';9import chaiAsPromised from 'chai-as-promised';1011chai.use(chaiAsPromised);1213const expect = chai.expect;1415describe('Connection smoke test', () => {16  it('Connection can be established', async () => {17    await usingApi(async api => {18      const health = await api.rpc.system.health();19      expect(health).to.be.not.empty;20    });21  });2223  it('Cannot connect to 255.255.255.255', async () => {24    const neverConnectProvider = new WsProvider('ws://255.255.255.255:9944');25    await expect((async () => {26      await usingApi(async api => {27        await api.rpc.system.health();28      }, {provider: neverConnectProvider});29    })()).to.be.eventually.rejected;30  });31});