21 lines
597 B
TypeScript
21 lines
597 B
TypeScript
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
|
import * as smartping from '../ts/index.js';
|
|
|
|
let testPing: smartping.Smartping;
|
|
|
|
tap.test('should create an instance of Smartping', async () => {
|
|
testPing = new smartping.Smartping();
|
|
expect(testPing).toBeInstanceOf(smartping.Smartping);
|
|
});
|
|
|
|
tap.test('should deliver a ping result', async () => {
|
|
const result = await testPing.ping('127.0.0.1', 1);
|
|
expect(result.alive).toBeTrue();
|
|
});
|
|
|
|
tap.test('should detect alive', async () => {
|
|
expect(await testPing.pingAlive('127.0.0.1', 1)).toBeTrue();
|
|
});
|
|
|
|
export default tap.start();
|