smarttime/test/test.cronmanager.browser.ts

28 lines
707 B
TypeScript
Raw Normal View History

2020-07-11 21:41:33 +00:00
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;
2020-09-03 20:14:23 +00:00
testCronManager.addCronjob('*/2 * * * * *', async () => {
2020-07-11 21:41:33 +00:00
if (counter === 10) {
done.resolve();
}
counter++;
console.log(`hey ${counter}`);
});
testCronManager.start();
await done.promise;
testCronManager.stop();
});
tap.start();