BREAKING CHANGE(smartnetwork): Enhance documentation and add configurable speed test options with plugin architecture improvements
This commit is contained in:
23
test/test.ts
23
test/test.ts
@ -12,6 +12,11 @@ tap.test('should perform a speedtest', async () => {
|
||||
const result = await testSmartNetwork.getSpeed();
|
||||
console.log(`Download speed for this instance is ${result.downloadSpeed}`);
|
||||
console.log(`Upload speed for this instance is ${result.uploadSpeed}`);
|
||||
// verify speeds are returned as strings and parse to positive numbers
|
||||
expect(typeof result.downloadSpeed).toEqual('string');
|
||||
expect(typeof result.uploadSpeed).toEqual('string');
|
||||
expect(parseFloat(result.downloadSpeed)).toBeGreaterThan(0);
|
||||
expect(parseFloat(result.uploadSpeed)).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
tap.test('should determine wether a port is free', async () => {
|
||||
@ -25,18 +30,28 @@ tap.test('should scan a port', async () => {
|
||||
});
|
||||
|
||||
tap.test('should get gateways', async () => {
|
||||
const gatewayResult = await testSmartNetwork.getGateways();
|
||||
console.log(gatewayResult);
|
||||
const gateways = await testSmartNetwork.getGateways();
|
||||
console.log(gateways);
|
||||
// verify gateways object has at least one interface
|
||||
expect(typeof gateways).toEqual('object');
|
||||
expect(Object.keys(gateways).length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
tap.test('should get the default gateway', async () => {
|
||||
const gatewayResult = await testSmartNetwork.getDefaultGateway();
|
||||
console.log(gatewayResult);
|
||||
const defaultGw = await testSmartNetwork.getDefaultGateway();
|
||||
console.log(defaultGw);
|
||||
// verify default gateway contains ipv4 and ipv6 info
|
||||
expect(defaultGw).toBeDefined();
|
||||
expect(defaultGw.ipv4).toBeDefined();
|
||||
expect(defaultGw.ipv6).toBeDefined();
|
||||
});
|
||||
|
||||
tap.test('should get public ips', async () => {
|
||||
const ips = await testSmartNetwork.getPublicIps();
|
||||
console.log(ips);
|
||||
// verify public IPs object contains v4 and v6 properties
|
||||
expect(ips).toHaveProperty('v4');
|
||||
expect(ips).toHaveProperty('v6');
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user