feat(smartnetwork): add Rust-powered network diagnostics bridge and IP intelligence lookups
This commit is contained in:
15
test/test.ts
15
test/test.ts
@@ -8,6 +8,10 @@ tap.test('should create a valid instance of SmartNetwork', async () => {
|
||||
expect(testSmartNetwork).toBeInstanceOf(smartnetwork.SmartNetwork);
|
||||
});
|
||||
|
||||
tap.test('should start the Rust bridge', async () => {
|
||||
await testSmartNetwork.start();
|
||||
});
|
||||
|
||||
tap.test('should perform a speedtest', async () => {
|
||||
const result = await testSmartNetwork.getSpeed();
|
||||
console.log(`Download speed for this instance is ${result.downloadSpeed}`);
|
||||
@@ -19,8 +23,9 @@ tap.test('should perform a speedtest', async () => {
|
||||
expect(parseFloat(result.uploadSpeed)).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
tap.test('should determine wether a port is free', async () => {
|
||||
await expect(testSmartNetwork.isLocalPortUnused(8080)).resolves.toBeTrue();
|
||||
tap.test('should determine whether a port is free', async () => {
|
||||
// Use a high-numbered port that's unlikely to be in use
|
||||
await expect(testSmartNetwork.isLocalPortUnused(59123)).resolves.toBeTrue();
|
||||
});
|
||||
|
||||
tap.test('should scan a port', async () => {
|
||||
@@ -54,4 +59,8 @@ tap.test('should get public ips', async () => {
|
||||
expect(ips).toHaveProperty('v6');
|
||||
});
|
||||
|
||||
tap.start();
|
||||
tap.test('should stop the Rust bridge', async () => {
|
||||
await testSmartNetwork.stop();
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
|
||||
Reference in New Issue
Block a user