diff options
author | eug-vs <eug-vs@keemail.me> | 2020-12-02 04:10:15 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-12-02 04:10:36 +0300 |
commit | 6f52408e7bf79730df9eb7b487dcacf468e409e1 (patch) | |
tree | 0bc1caf00ad8a95ac4faa438ff2f848529d36a2b /test/event.model.test.ts | |
parent | 40ffcc5e78f5ee41353e383ca25b81134084ab9f (diff) | |
download | mongo-cronjob-6f52408e7bf79730df9eb7b487dcacf468e409e1.tar.gz |
test: Event model
Diffstat (limited to 'test/event.model.test.ts')
-rw-r--r-- | test/event.model.test.ts | 34 |
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'); + }) +}); |