import { expect, tap } from '@push.rocks/tapbundle';
import * as helpers from './helpers/index.js';

import * as cloudly from '../ts/index.js';

let testCloudly: cloudly.Cloudly;
tap.test('first test', async () => {
  testCloudly = await helpers.createCloudly();
  expect(testCloudly).toBeInstanceOf(cloudly.Cloudly);
});

tap.test('should init cloudly', async () => {
  await testCloudly.start();
});

tap.test('should end the service', async (tools) => {
  await tools.delayFor(5000);
  await helpers.stopCloudly();
  await testCloudly.stop();
  tools.delayFor(1000).then(() => process.exit());
});

tap.start();