diff options
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'); + }) +}); |