2026-05-01 21:44:49 +00:00
|
|
|
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
2022-10-20 08:24:20 +02:00
|
|
|
import * as smartping from '../ts/index.js';
|
2018-11-18 15:06:17 +01:00
|
|
|
|
2022-10-21 11:55:42 +02:00
|
|
|
let testPing: smartping.Smartping;
|
|
|
|
|
|
|
|
|
|
tap.test('should create an instance of Smartping', async () => {
|
|
|
|
|
testPing = new smartping.Smartping();
|
|
|
|
|
expect(testPing).toBeInstanceOf(smartping.Smartping);
|
2022-10-20 08:24:20 +02:00
|
|
|
});
|
2018-11-18 15:06:17 +01:00
|
|
|
|
2022-10-21 12:06:24 +02:00
|
|
|
tap.test('should deliver a ping result', async () => {
|
2026-05-01 21:44:49 +00:00
|
|
|
const result = await testPing.ping('127.0.0.1', 1);
|
|
|
|
|
expect(result.alive).toBeTrue();
|
|
|
|
|
});
|
2022-10-21 12:06:24 +02:00
|
|
|
|
2022-10-21 11:55:42 +02:00
|
|
|
tap.test('should detect alive', async () => {
|
2026-05-01 21:44:49 +00:00
|
|
|
expect(await testPing.pingAlive('127.0.0.1', 1)).toBeTrue();
|
|
|
|
|
});
|
2022-10-21 11:55:42 +02:00
|
|
|
|
2026-05-01 21:44:49 +00:00
|
|
|
export default tap.start();
|