import { expect, tap } from '@pushrocks/tapbundle'; import * as smartnetwork from '../ts/index'; let testSmartNetwork: smartnetwork.SmartNetwork; tap.test('should create a valid instance of SmartNetwork', async () => { testSmartNetwork = new smartnetwork.SmartNetwork(); expect(testSmartNetwork).to.be.instanceOf(smartnetwork.SmartNetwork); }); tap.test('should perform a speedtest', async () => { const result = await testSmartNetwork.getSpeed(); console.log(`Download speed for this instance is ${result.download.bandwidth}`); console.log(`Upload speed for this instance is ${result.download.bandwidth}`); }); tap.test('should determine wether a port is free', async () => { await expect(testSmartNetwork.isLocalPortUnused(8080)).to.eventually.be.true; }); tap.test('should scan a port', async () => { await expect(testSmartNetwork.isRemotePortAvailable('lossless.com:443')).to.eventually.be.true; await expect(testSmartNetwork.isRemotePortAvailable('lossless.com', 443)).to.be.eventually.true; // await expect(testSmartNetwork.isRemotePortAvailable('lossless.com:444')).to.eventually.be.false; }); tap.test('should get gateways', async () => { const gatewayResult = await testSmartNetwork.getGateways(); console.log(gatewayResult); }); tap.test('should get the default gateway', async () => { const gatewayResult = await testSmartNetwork.getDefaultGateway(); console.log(gatewayResult); }); tap.test('should get public ips', async () => { const ips = await testSmartNetwork.getPublicIps(); console.log(ips); }); tap.start();