fix(core): update
This commit is contained in:
27
test/test.cronmanager.browser.ts
Normal file
27
test/test.cronmanager.browser.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
|
||||
import * as smarttime from '../ts/index';
|
||||
|
||||
let testCronManager: smarttime.CronManager;
|
||||
|
||||
tap.test('should create a valid instance of cronmanager', async () => {
|
||||
testCronManager = new smarttime.CronManager();
|
||||
expect(testCronManager).to.be.instanceOf(smarttime.CronManager);
|
||||
});
|
||||
|
||||
tap.test('should create a valid cronJon', async (tools) => {
|
||||
const done = tools.defer();
|
||||
let counter = 0;
|
||||
testCronManager.addCronjob('*/2 * * * * *', () => {
|
||||
if (counter === 10) {
|
||||
done.resolve();
|
||||
}
|
||||
counter++;
|
||||
console.log(`hey ${counter}`);
|
||||
});
|
||||
testCronManager.start();
|
||||
await done.promise;
|
||||
testCronManager.stop();
|
||||
});
|
||||
|
||||
tap.start();
|
@ -9,7 +9,7 @@ tap.test('should create a valid instance of cronmanager', async () => {
|
||||
expect(testCronManager).to.be.instanceOf(smarttime.CronManager);
|
||||
});
|
||||
|
||||
tap.test('should create a valid cronJon', async tools => {
|
||||
tap.test('should create a valid cronJon', async (tools) => {
|
||||
const done = tools.defer();
|
||||
let counter = 0;
|
||||
testCronManager.addCronjob('*/2 * * * * *', () => {
|
||||
|
@ -5,7 +5,7 @@ import * as smarttime from '../ts/index';
|
||||
// Test TimeStamp class
|
||||
let testTimeStamp: smarttime.TimeStamp;
|
||||
let testTimeStamp2: smarttime.TimeStamp;
|
||||
tap.test('should create valid testTimeStamp instance', async tools => {
|
||||
tap.test('should create valid testTimeStamp instance', async (tools) => {
|
||||
testTimeStamp = new smarttime.TimeStamp();
|
||||
await tools.delayFor(2);
|
||||
testTimeStamp2 = new smarttime.TimeStamp();
|
||||
@ -23,7 +23,7 @@ tap.test('should have valid linuxtime', async () => {
|
||||
let testHrtMeasurement: smarttime.HrtMeasurement;
|
||||
|
||||
// Test HrtMeasurement
|
||||
tap.test('should create valid HrtMeasurements', async tools => {
|
||||
tap.test('should create valid HrtMeasurements', async (tools) => {
|
||||
testHrtMeasurement = new smarttime.HrtMeasurement();
|
||||
testHrtMeasurement.start();
|
||||
await tools.delayFor(20);
|
||||
@ -41,7 +41,7 @@ tap.test('should combine units', async () => {
|
||||
weeks: 2,
|
||||
days: 2,
|
||||
hours: 2,
|
||||
minutes: 2
|
||||
minutes: 2,
|
||||
});
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(computedTime);
|
||||
|
Reference in New Issue
Block a user