detector/test/test.ts
2021-04-14 11:47:51 +00:00

22 lines
644 B
TypeScript

import { expect, tap } from '@pushrocks/tapbundle';
import * as detector from '../ts/index';
let testDetector: detector.Detector;
tap.test('first test', async () => {
testDetector = new detector.Detector();
expect(testDetector).to.be.instanceOf(detector.Detector);
});
tap.test('should detect an closed port on a local domain', async () => {
const result = await testDetector.isActive('http://localhost:3008');
expect(result).to.be.false;
});
tap.test('should detect an open port on a remote domain', async () => {
const result = await testDetector.isActive('https://lossless.com');
expect(result).to.be.true;
});
tap.start();