blob: b06b2685eb5b3ce7c49a598c417c44f86519ba6c (
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
46
|
import { expect } from 'chai';
import client from './client';
const Model = client.Event;
describe('Event model', () => {
after(async () => {
client.connection.dropCollection('events');
});
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');
});
});
|