aboutsummaryrefslogtreecommitdiff
path: root/test/event.model.test.ts
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-12-02 04:10:15 +0300
committereug-vs <eug-vs@keemail.me>2020-12-02 04:10:36 +0300
commit6f52408e7bf79730df9eb7b487dcacf468e409e1 (patch)
tree0bc1caf00ad8a95ac4faa438ff2f848529d36a2b /test/event.model.test.ts
parent40ffcc5e78f5ee41353e383ca25b81134084ab9f (diff)
downloadmongo-cronjob-6f52408e7bf79730df9eb7b487dcacf468e409e1.tar.gz
test: Event model
Diffstat (limited to 'test/event.model.test.ts')
-rw-r--r--test/event.model.test.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/event.model.test.ts b/test/event.model.test.ts
new file mode 100644
index 0000000..05afb7a
--- /dev/null
+++ b/test/event.model.test.ts
@@ -0,0 +1,34 @@
+import { expect } from 'chai';
+import Model from './model';
+
+describe('Event model', () => {
+ it('Should assign status and nextRunAt on creation', async () => {
+ const event = await Model.create({
+ type: 'test',
+ schedule: '* * * * *',
+ context: {
+ message: 'Hello, world!'
+ },
+ });
+ expect(event.status).equal('notStarted');
+ expect(event).to.have.property('nextRunAt');
+ });
+
+ describe('Methods', () => {
+ it('log', async () => {
+ const event = await Model.findOne();
+ const log = await event?.log('Test message');
+ expect(log).to.have.property('message').equal('Test message');
+ });
+
+ it('start');
+
+ it('complete');
+
+ it('fail');
+
+ it('getLogs')
+
+ it('computeNextRunAt');
+ })
+});