blob: d7a4601b573dd4eeec79923207c3e7cf1a00ef88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
import { expect } from 'chai';
import Model from './model';
import connection from './utils/dbConnection';
describe('Event model', () => {
after(async () => {
connection.dropCollection('customevents');
});
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');
});
describe('Statics', () => {
it('findNextEvents');
it('findMissedEvents');
});
});
|