aboutsummaryrefslogtreecommitdiff
path: root/test/scheduler.test.ts
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-12-02 15:26:25 +0300
committereug-vs <eug-vs@keemail.me>2020-12-02 15:26:25 +0300
commitf8ebf581f8272615f48ce355c6b2cbf8248c73bd (patch)
tree9473834f4045a9375dc0db48f042f4a6df0e016c /test/scheduler.test.ts
parent994e0df96267b3de4d82926555ac4c4c7eefe14a (diff)
downloadmongo-cronjob-f8ebf581f8272615f48ce355c6b2cbf8248c73bd.tar.gz
feat: export client class
Diffstat (limited to 'test/scheduler.test.ts')
-rw-r--r--test/scheduler.test.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/scheduler.test.ts b/test/scheduler.test.ts
index ffcd623..1736ed4 100644
--- a/test/scheduler.test.ts
+++ b/test/scheduler.test.ts
@@ -1,12 +1,12 @@
import { expect } from 'chai';
import Scheduler from '../lib/scheduler';
-import Model, { CustomEvent } from './model';
-import connection from './utils/dbConnection';
+import client, { Event } from './client';
+const Model = client.Event;
const sleep = async (time: number) => new Promise<void>(res => setTimeout(res, time));
describe('Scheduler', async () => {
- let event: CustomEvent;
+ let event: Event;
let scheduler: Scheduler;
beforeEach(() => {
@@ -28,14 +28,14 @@ describe('Scheduler', async () => {
});
after(async () => {
- connection.dropCollection('customevents');
+ client.connection.dropCollection('events');
});
it('Should run event', async () => {
// Wait until job is run
await new Promise<void>(res => {
- scheduler.registerHandler('test', async (event: CustomEvent) => {
+ scheduler.registerHandler('test', async (event: Event) => {
await sleep(2000);
await event.log(event.context.message)
res();