2018-07-17 07:00:27 +00:00
|
|
|
import { expect, tap } from '@pushrocks/tapbundle';
|
|
|
|
import * as smartnetwork from '../ts/index';
|
2017-12-12 22:35:20 +00:00
|
|
|
|
2018-07-17 07:00:27 +00:00
|
|
|
let testSmartNetwork: smartnetwork.SmartNetwork;
|
2017-12-12 22:35:20 +00:00
|
|
|
|
|
|
|
tap.test('should create a valid instance of SmartNetwork', async () => {
|
2018-07-17 07:00:27 +00:00
|
|
|
testSmartNetwork = new smartnetwork.SmartNetwork();
|
|
|
|
expect(testSmartNetwork).to.be.instanceOf(smartnetwork.SmartNetwork);
|
|
|
|
});
|
2017-12-12 22:35:20 +00:00
|
|
|
|
|
|
|
tap.test('should perform a speedtest', async () => {
|
2018-07-17 07:00:27 +00:00
|
|
|
let result = await testSmartNetwork.getSpeed();
|
|
|
|
console.log(`Download speed for this instance is ${result.speeds.download}`);
|
|
|
|
console.log(`Upload speed for this instance is ${result.speeds.upload}`);
|
|
|
|
});
|
2017-12-12 22:35:20 +00:00
|
|
|
|
2018-07-17 07:00:27 +00:00
|
|
|
tap.test('should determine wether a port is free', async () => {
|
|
|
|
await expect(testSmartNetwork.isLocalPortAvailable(8080)).to.eventually.be.true;
|
|
|
|
});
|
|
|
|
|
2019-04-16 08:21:11 +00:00
|
|
|
tap.test('should scan a port', async () => {
|
2019-09-06 16:26:32 +00:00
|
|
|
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;
|
2019-04-16 08:21:11 +00:00
|
|
|
});
|
|
|
|
|
2019-09-08 14:15:10 +00:00
|
|
|
tap.test('should get gateways', async () => {
|
2019-09-08 12:59:47 +00:00
|
|
|
const gatewayResult = await testSmartNetwork.getGateways();
|
2019-09-06 16:26:32 +00:00
|
|
|
console.log(gatewayResult);
|
2019-09-06 16:28:39 +00:00
|
|
|
});
|
2019-09-06 16:26:32 +00:00
|
|
|
|
2019-09-08 14:15:10 +00:00
|
|
|
tap.test('should get the default gateway', async () => {
|
|
|
|
const gatewayResult = await testSmartNetwork.getDefaultGateway();
|
|
|
|
console.log(gatewayResult);
|
|
|
|
});
|
|
|
|
|
2018-07-17 07:00:27 +00:00
|
|
|
tap.start();
|