2024-05-15 10:10:41 +02:00
|
|
|
delete process.env.CLI_CALL;
|
|
|
|
|
import * as coretraffic from '../ts/index.js';
|
|
|
|
|
|
2026-04-28 12:02:58 +00:00
|
|
|
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
2024-05-15 10:10:41 +02:00
|
|
|
import { Qenv } from '@push.rocks/qenv';
|
|
|
|
|
|
|
|
|
|
const testQenv = new Qenv('./', './.nogit');
|
|
|
|
|
let testCoreTraffic: coretraffic.CoreTraffic;
|
2026-04-28 12:02:58 +00:00
|
|
|
const shouldRunIntegrationTests = process.env.CORETRAFFIC_INTEGRATION_TESTS === 'true';
|
2024-05-15 10:10:41 +02:00
|
|
|
|
|
|
|
|
tap.test('should create an coretraffic instance', async (tools) => {
|
|
|
|
|
testCoreTraffic = new coretraffic.CoreTraffic();
|
|
|
|
|
expect(testCoreTraffic).toBeInstanceOf(coretraffic.CoreTraffic);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
tap.test('should start the instance', async (tools) => {
|
2026-04-28 12:02:58 +00:00
|
|
|
tools.skipIf(!shouldRunIntegrationTests, 'set CORETRAFFIC_INTEGRATION_TESTS=true to start CoreTraffic');
|
2024-05-15 10:10:41 +02:00
|
|
|
await testCoreTraffic.start();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
tap.test('should keep the instance alive', async (tools) => {
|
2026-04-28 12:02:58 +00:00
|
|
|
tools.skipIf(!shouldRunIntegrationTests, 'set CORETRAFFIC_INTEGRATION_TESTS=true to keep CoreTraffic alive');
|
2024-05-15 10:10:41 +02:00
|
|
|
await tools.delayFor(10000);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
tap.test('should stop the instance', async (tools) => {
|
2026-04-28 12:02:58 +00:00
|
|
|
tools.skipIf(!shouldRunIntegrationTests, 'set CORETRAFFIC_INTEGRATION_TESTS=true to stop CoreTraffic');
|
2024-05-15 10:10:41 +02:00
|
|
|
await testCoreTraffic.stop();
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-28 12:02:58 +00:00
|
|
|
export default tap.start();
|