diff options
author | eug-vs <eug-vs@keemail.me> | 2020-12-04 01:12:54 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-12-04 01:14:12 +0300 |
commit | 569cb0457b4cdcffdf325bdfe8959d55e48efc25 (patch) | |
tree | edc092e392ef9ec619964a917017a9d40ad6f659 /test | |
parent | d513b23be26bda40d40ec43258345af6e34cfdfd (diff) | |
download | mongo-cronjob-569cb0457b4cdcffdf325bdfe8959d55e48efc25.tar.gz |
feat!: remove context schema from client
This will allow for multiple event types in one Model.
Diffstat (limited to 'test')
-rw-r--r-- | test/client.ts | 14 | ||||
-rw-r--r-- | test/scheduler.test.ts | 10 |
2 files changed, 10 insertions, 14 deletions
diff --git a/test/client.ts b/test/client.ts index 182859b..5f96339 100644 --- a/test/client.ts +++ b/test/client.ts @@ -1,19 +1,7 @@ -import { Schema } from 'mongoose'; import { Client } from '../lib'; -import { Event as EventBase } from '../lib/event.model'; import connection from './utils/dbConnection'; -interface Context { - message: string; -} - -export type Event = EventBase<Context>; - -const contextSchema = new Schema({ - message: String -}); - -const client = new Client<Context>(connection, contextSchema); +const client = new Client(connection); export default client; diff --git a/test/scheduler.test.ts b/test/scheduler.test.ts index 1736ed4..c341cc8 100644 --- a/test/scheduler.test.ts +++ b/test/scheduler.test.ts @@ -1,6 +1,14 @@ import { expect } from 'chai'; import Scheduler from '../lib/scheduler'; -import client, { Event } from './client'; +import { Event as EventBase } from '../lib/event.model'; +import client from './client'; + +interface Context { + message: string; +} + +type Event = EventBase<Context>; + const Model = client.Event; const sleep = async (time: number) => new Promise<void>(res => setTimeout(res, time)); |